Finding the first digits of 2^2^2^2^2^2​
​by James H. Choi

Abstract

2^2^2^2^2^2, more specifically, 2^(2^(2^(2^(2^2)))) is a very large number. So large, it has been said, not even its first digit is known.
​
Indeed, a straightforward evaluation results in overflow, both in integer and in float, even in Mathematica.
​
 However, it is possible to obtain as many first digits as memory allows by using properties of log’s mantissa.

The “bigness” of 2^2^2^2^2^2 (six 2s)

2^2^2^2^2^2 (with six 2s), more specifically 2^(2^(2^(2^(2^2)))) is very big. It results in overflow in both integer and float computations even in Mathematica.
2^2^2^2^2^2
General
:Overflow occurred in computation.
Out[]=
Overflow[]
2^2^2^2^2^2.
General
:Overflow occurred in computation.
Out[]=
Overflow[]
However, 2^(2^(2^(2^2))) (with five 2s) can be evaluated,
Short[2^2^2^2^2,1/3]
Out[]//Short=
20035299304019705905719156736
resulting in a 19,729-digit integer.
IntegerLength[2^2^2^2^2]
Out[]=
19729
The sheer size of this 19,729-digit number should be appreciated in perspective. For example, Avogadro’s number has 24 digits, and the number of atoms in the known universe has somewhere around 80 digits. A 100-digit number is a rare creature. For example, in order to have 100-digit count of atoms in the universe, the universe has to expand on minimum 1,000,000,000,000,000,000 times (in voluming, assuming the density is maintained) than the current known one.
​
Going back to the main topic at hand, the availability of 19,729-digit evaluation of 2^2^2^2^2 (five 2s) allows us to move one step further toward finding the starting digits of 2^2^2^2^2^2 (with six 2s) as shown below.

Start with of
n=2^2^2^2^2
(five 2s) then find
n
2
(six 2s)

This problem can be approached by finding 2^2^2^2^2 (five 2s) first, as shown above, then evaluating 2 raised to that number. That is,
In[]:=
n=2^2^2^2^2;
Then finding
n
2
in such a way that it will reveal the first digits.

Mantissa

"An important property of base-10 logarithms, which makes them so useful in calculations, is that the logarithm of numbers greater than 1 that differ by a factor of a power of 10 all have the same fractional part. The fractional part is known as the mantissa." Source: Common Logarithm, Wikipedia​
​​
​In other words, the logarithms with base 10 of numbers that start with 12345, regardless of where the decimal point is placed,
Log[10.,#]&/@{0.12345,1.2345,12.345,123.45,1234.5,12345,123450,1234500}
Out[]=
{-0.908509,0.0914911,1.09149,2.09149,3.09149,4.09149,5.09149,6.09149}
will all have the same mantissa of ≈0.0914911. Although Mantissa is defined as “fractional part,” Mod[number, 1] operation should be used to guard against positive numbers less than 1 which will produce negative exponents.
Mod[#,1]&/@%
Out[]=
{0.0914911,0.0914911,0.0914911,0.0914911,0.0914911,0.0914911,0.0914911,0.0914911}
It means we only need to know the mantissa of the exponent
p
when 2^2^2^2^2^2 (six 2s) is expressed as
​
​
n
2
=
p
10
​
​
in order to know the first digits of
n
2
which is 2^2^2^2^2^2 (six 2s).
​
By taking
log
10
()
on both sides we can solve for
p
.
​
​
p
log
10
(
n
2
)n
log
10
(2)
​
​
This re-writing above of log expression using identity is the most crucial step because it allows us to sidestep
n
2
, which is too big to be computed (if it wasn't, we wouldn't be doing all this mental gymnastics after all). On the other hand, computing
n
log
10
(2)
is within reach because we already obtained n above, and multiplying it by
log
10
(2)
, which is around 0.301, won't cause overflow. Now, we just need to find
log
10
(2)
in high enough precision.

High enough precision for
log
10
(2)

Empirically check the accuracy of the mantissa vs the accuracy of the first digits. That is, how many digits of mantissa is needed to reproduce the starting digit sequence of 23456789. It appears having about 4-digit accuracy in mantissa is need to ensure the reproduction of the first four digit in the original number. We will assume this 1:1 correspondence between these accuracies.
In[]:=
N[Log[10,23456789],10]
Out[]=
7.370268561
In[]:=
0.3
10
Out[]=
1.99526
In[]:=
0.37
10
Out[]=
2.34423
In[]:=
0.3702
10
Out[]=
2.34531
In[]:=
0.37026
10
Out[]=
2.34563
In[]:=
0.370268
10
Out[]=
2.34568
How high a precision do we need? We use the number of digits of
n
as our guide.
digitLength=IntegerLength[n]
Out[]=
19729
In other words, in order to reproduce the integer part of
n
accurately, we need 19,729-digit precision. However, the mantissa that we are after starts after the decimal point. Our precision has to be at least 4 more than that.
​
However, since we are not sure about the 1:1 accuracy correspondence assumed above, instead of playing near the fire, we just double the required accuracy to 19,729
×2=
39,458 as a safety factor. This ensures that the mantissa has 19,729-digit accuracy after 19,729-digit accuracy integer part is taken out.
log2Base10=N[Log[10,2],2digitLength];
Due to its length, only the first 50 digits are shown.
N[log2Base10,50]
Out[]=
0.30102999566398119521373889472449302676818988146211
(I have been carrying this 0.301 in my memory since my high school days. Not once have I suspected that I would try to obtain this number to its 39,458th digit some day. But here we are.)​
​
Find the mantissa which corresponds to the fractional part of
n
log
10
(2)
.
In[]:=
mantissa=FractionalPart[(nlog2Base10)];
Only the first 50 digits are shown for brevity.
N[mantissa,50]
Out[]=
0.32634379468066900395431106748523745510481197775106

Find the first thousands of digits of 2^2^2^2^2^2 (six 2s)

Then find the starting digits of
n
log
10
(2)
10
. Only the first 50 digits are shown for brevity.
N[10^mantissa,50]
Out[]=
2.1200387288082119848851646916622746308356542306754
The number above should not be confused with the actual 2^2^2^2^2^2 (six 2s).
​
2^2^2^2^2^2 (six 2s) is an integer that starts with the digits above and continues on to many digits. As for exactly how many digits, it will be computed below.
​
Our mission to find the first digits of 2^2^2^2^2^2 (six 2s) is accomplished.

Find the number of digits in 2^2^2^2^2^2 (six 2s)

We also can find out how many digits 2^2^2^2^2^2 (six 2s) has by using the non-mantissa, i.e., the integer part of
log
2
n
. The number of digits in 2^2^2^2^2^2 (six 2s) would be one more than the number below which was not shown due to its length.
In[]:=
intergerExponent=IntegerPart[(nlog2Base10)];
Its few digits can be glimpsed by using Short function.
Short[intergerExponent,1/3]
Out[]//Short=
60312260626302953719692149530140391357847
The number of digits of the number of digits of 2^2^2^2^2^2 (six 2s) is.
IntegerLength[intergerExponent]+1
Out[]=
19729

The order of magnitude of the number of digits in
m
2
vs the number
m
in general

The number of digits of the number of digits of
n
2
is 19,729 which is also the number of digits of
n
. Is this a coincidence?
​
This implies that the number of digits of
n
2
has the same order of magnitude as
n
. This question would be more intuitive if the base was 10. But even with base 2, this is possible to establish a pattern.
​
In general, the number of digits in
m
2
(in base 10) can be expressed as
log
10
(
m
2
)+1=m
log
10
(2)+1≈0.301m+1

​
Since
0.301m+1
would have the same (or one smaller) order of magnitude as
m
, it follows that the number of digits of
m
2
has the same (or one smaller order of magnitude as
m
.

An attempt to grasp the size of 2^2^2^2^2^2 (six 2s)

These numbers
n=2^2^2^2^2
(five 2s) and
n
2
(six 2s) are so large, we have to express them with the order of magnitude of the order of magnitude, which we abbreviate as ofmotofm here.​Using this newly defined function, we obtain​​
ofmotofm(n)=5​​ofmotofm(
n
2
)=19279
​​To put in perspective​​
ofmotofm
(Avogadro’s number)
=2
​​
ofmotofm
(number of all atoms in the universe)
=2
​​While an increase of 1 in the order of magnitude means the number was multiplied by roughly 10 (or
x
became
10x
), an increase of 1 in
ofmotofm
value means the exponent m in
m
10
roughly ten folded to
10m
10
(or
x
became
10
x
)
.​Consider one of the most dramatic change in size in we can imagine. Going from the size of a proton is
-12
10
to the distance to Andromeda is
24
10
. Their ratio is about
36
10
, i.e., their orders of magnitude increase is 36. But in
ofmotofm
, because
ofmotofm(
0
10
)=0
and
ofmotofm(
36
10
)=2
, it increased by 2. It is doubtful there are any two objects in this universe we can compare that would produce ofmotofm value difference that goes much beyond 2 or 3.​In that light, the jump of 19,274 (
19279-5
) between
n
and
n
2
in their respective ofmotofm values demonstrates just how far beyond our comprehension these numbers are.

Acknowledgements

I would like to thank Dr. Stephen Wolfram who inadvertently made me aware of this challenge through this video https://www.youtube.com/watch?v=Ak0x5iz3mfg&t=661s .
​
I would like to thank Mr. Ed Pegg who not only confirmed the accuracy of the solution, but also encouraged me to write it up in this community. I could not have discovered this his guidance.
​
And I also thank Prof. Manoel Montagnoli who taught me mathematics.