Skip to content

Instantly share code, notes, and snippets.

@dannysauer
Created April 22, 2025 17:41
Show Gist options
  • Save dannysauer/5298db16229f6600d755c9330409b9b0 to your computer and use it in GitHub Desktop.
Save dannysauer/5298db16229f6600d755c9330409b9b0 to your computer and use it in GitHub Desktop.
Print out all the numbers from one to one million

num2words is available on Ubuntu and friends:

sudo apt install python3-num2words

Else:

pip install --user num2words

Then it's just ./numbers.py > amillion.txt

#!/usr/bin/env python3
from num2words import num2words
from sys import stderr
for i in range(1, 1000000 + 1):
# print a status line every 10K
if 0 == i % 10000:
print(i, file=stderr)
print(num2words(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment