Skip to content

Instantly share code, notes, and snippets.

@goulu
Created May 28, 2021 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goulu/13ee3a2d8145398b75d008d55d66196a to your computer and use it in GitHub Desktop.
Save goulu/13ee3a2d8145398b75d008d55d66196a to your computer and use it in GitHub Desktop.
"stores" and prints gogol and gogolplex numbers
from itertools import product
from Goulib.itertools2 import ilen
ten = range(10)
def tenpow(p):
# p is the log of exponent
return product(ten, repeat=p)
def tenprint(iter):
print('1', end='')
for _ in iter:
print('0', end='')
print()
def tenshort(iter):
print('10^',ilen(iter))
gogol = tenpow(2) # 10^100 : log of the 100 exponent is 2
tenprint(gogol)
tenshort(tenpow(3)) # 10^1000
gogolplex = tenpow(100) # 10^10^100 : log of the 10^100 exponent is 100
tenprint(gogolplex) # might take some time ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment