Created
May 28, 2021 05:30
-
-
Save goulu/13ee3a2d8145398b75d008d55d66196a to your computer and use it in GitHub Desktop.
"stores" and prints gogol and gogolplex numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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