So we were given a task for some bonus points to calculate and give the teacher the exact number of $9^{9^9}$. But the number is so big that I couldn't find where to calculate it to receive a precise number. I used python with a gmpy libraby to get a precise number but after almost 4 hours of running it crashed after it ran out of memory. So I am wondering is there actually a way to calculate the precise number?
-
$\begingroup$ Exponentiation is not associative. Please use parenthesis. $\endgroup$– Asaf Karagila ♦Sep 22, 2015 at 18:49
-
3$\begingroup$ it is easy to write in base 9 :) $\endgroup$– Nikolay GromovSep 22, 2015 at 18:53
-
$\begingroup$ do you want the result by email? it is about 1Gb long $\endgroup$– Nikolay GromovSep 22, 2015 at 18:59
-
2$\begingroup$ @NikolayGromov: It's even easier to write down in base $9^{9^9}$. $\endgroup$– celtschkSep 22, 2015 at 19:06
-
$\begingroup$ What do you want, an explanation about how one might speed up the computation? Or people just throwing digits at you, surely that must be your goal... $\endgroup$– pjs36Sep 22, 2015 at 19:07
5 Answers
Since $9^9 = 387420489$, you have $$\log_{10} 9^{9^9} = 9^9 \log_{10} 9 = 369693099.6\ldots$$ so that the resulting number has 369,693,099 $+$ 1 digits.
-
$\begingroup$ which is less then 1Gb, so assuming 8Gb memory it should be possible to compute it $\endgroup$ Sep 22, 2015 at 18:58
-
$\begingroup$ @Nikolay: That depends on how you store the digits. But in generally I don't think it's about memory, it's probably about computation time. $\endgroup$– Asaf Karagila ♦Sep 22, 2015 at 19:20
-
$\begingroup$ the same objections as some other authors - does not answer the question. It give an impression that the answer is "no way". $\endgroup$ Sep 22, 2015 at 22:06
-
$\begingroup$ @NikolayGromov feel free to downvote if you don't like the answer. $\endgroup$ Sep 22, 2015 at 22:20
-
$\begingroup$ @UmbertoP., I generally delete my comments pointing out minor errors once they've been fixed, to remove clutter. I'll delete this one too once you've had a chance to read it (which you can indicate by deleting your reply). I had to think about whether the rounding goes up or down. $\endgroup$ Sep 22, 2015 at 22:31
First $~80$ digits:
$$428124773175747048036987115930563521339055482241443514174753723053523887471735048$$
The rest I can share with dropbox. My estimate - with mathematica it will take about $<7$ days to compute all digits, if you want to try run this:
res = 9^9^SetPrecision[9., M]
where $M$ is the number of digits. First $10000$ digits take about $4$ minutes.
Update:
In Mathematica it take $9$ seconds. The trick to make it faster is to write
res = 9^(9^9);
that's what Robert Israel did in Maple
Update2:
Tried the same order of operations in Python - does not work
import gmpy2
a = gmpy2.mpz('9')**gmpy2.mpz('9')
gmpy2.mpz('9')**a
crashed kernel in 10 seconds. May be some memory issues.
-
$\begingroup$ Dropbox is no fun. Write it out using paper and ink and send it to the OP's teacher by mail. $\endgroup$ Sep 22, 2015 at 19:06
-
$\begingroup$ I wonder how many pages it would take at 12-sized times new roman :~) $\endgroup$ Sep 22, 2015 at 19:24
-
$\begingroup$ About $105000$ for 11-size in Calibri, no ideas about 12 $\endgroup$ Sep 22, 2015 at 19:27
Maple does
r := 9^(9^9):
in about 10 seconds on my computer. Outputting the result to a file in Maple's internal format (an m-file) takes about 170 seconds (the file is about 208 Mb). Saving to a text file (in decimal format) takes about 178 seconds: the file is about 379 Mb.
-
$\begingroup$ Spectacular! Mathematica is much slow in this case which is strate as for such basic operations they both use the same C package for multiple precision algebra. $\endgroup$ Sep 22, 2015 at 19:43
-
$\begingroup$ In Mathematica that's the same in fact - about $9$ sec. $\endgroup$ Sep 22, 2015 at 19:54
Well, whatever number you meant $x=(9^9)^9, 9^{9^9}$ you can give your teacher the answer:$x=1$. It is just written in the $x$-ary basis. It is impossible for any computer to calculate the second number $x$ in decimal expansion.
Edit: Clearly I was wrong regarding the computer power required to perform the calculation!
-
$\begingroup$ are you hinting they are using Python at school? $\endgroup$ Sep 22, 2015 at 18:55
-
$\begingroup$ Wow, I severely misjudged nowadays computational power. I am not so familiar with computer calculations. $\endgroup$ Sep 22, 2015 at 21:31
Let $y=9^{9^{9}}$
$\log_{10}(y) = 9^9\log_{10}(9) = 9^{9}\times \times 2 \times 0.4771 = 369676630.6038 $
So $\log_{10}(y) = 369676630.6038\Rightarrow y=10^{369676630.6038}$
-
-
$\begingroup$ No It is odd no. bcz we have take approx of $\log_{10}(3) = 0.4771$ $\endgroup$ Sep 22, 2015 at 18:59
-
1$\begingroup$ So your answer is not exact. You might want to make this clear. $\endgroup$– quid ♦Sep 22, 2015 at 19:00
-
-
1$\begingroup$ This does not answer the question, just points out that the number is big. It is not too big, to be honest. It is doable. $\endgroup$ Sep 22, 2015 at 20:08