# What is the millionth decimal digit of the $10^{10^{10^{10}}}$-th prime?

What is the millionth decimal digit of the $10^{10^{10^{10}}}$th prime?

(This prime, with more than $10^{10^{10}}$ decimal digits, is far larger than the largest "known" prime.) The answer should include a proof of correctness. I'm posting this question in the spirit of this advice, and will eventually post an answer (with proof of a more general result) if no one else does so.

NB: The notation $10^{10^{10^{10}}}$ means the same as $10^{(10^{(10^{10})})}$, and the "millionth digit" means the millionth digit from the left, as usually written (i.e., the most significant digit is leftmost and is called the 1st digit).

Afterthought: It might have been more impressive to have asked for the $10^{10}$th digit of, say, the $10^{10^{10^{10^{10}}}}$th prime (that digit being $8$), since perhaps no one has ever before computed the ten-billionth digit of a particular prime.

• Does $(10^{1000})$th prime number has million digits ?
– Peđa
Oct 28, 2011 at 15:11
• I hope this has nothing to do with Benford's Law.
– user13838
Oct 28, 2011 at 15:43
• The millionth most significant digit, or millionth least significant digit? Oct 28, 2011 at 15:53
• @pedja: In case you're not familiar with the conventions ... Both 10^10^10^10 and $10^{10^{10^{10}}}$ are intended to mean 10^(10^(10^10)), which is a number with 1 + 10^(10^10) digits. By Rosser's theorem, the $n$th prime is greater than $n \ ln \ n$, so the 10^(10^(10^10))th prime has far more than 10^(10^10) digits. Oct 28, 2011 at 15:55
• Known upper and lower bounds for $p_n$ are in principle sharp enough to pin down the millionth digit. However, finding $\log n$ to sufficient accuracy may be difficult. Oct 28, 2011 at 16:03

The following bound on the $n$-th prime ($p_n$) is known: for $n > 6$, $$n\left(\log{n} + \log\log{n} - 1\right) < p_n < n\left(\log{n} + \log\log{n}\right).$$ For $n=10^{10^{10^{10}}}$, we have $$\log{n} = 10^{10^{10}}\log{10},$$ a number with ten billion and one digits before the decimal point, and $$\log\log{n} = 10^{10}\log{10} + \log\log{10} \approx 23 025 850 931,$$ a number with eleven digits before the decimal point. Since the latter number is about ten billion digits shorter than the former, the millionth digit of $p_n$ is the same as the millionth digit of $n\log{n}$; that is, we can ignore the $n\log\log{n}$ correction$^{\dagger}$. But $$n\log{n} = 10^{10^{10^{10}}}\cdot 10^{10^{10}}\log{10} = 10^{\left(10^{10^{10}} + 10^{10}\right)}\log{10}$$ is a large power of ten multiplied by $\log{10}$, and so its millionth digit is the same as the millionth digit of $\log{10}$ (i.e., the 999999-th digit after the decimal). This digit can be found in a number of places (e.g., at [numberworld.org]), and is equal to $5$.

$^\dagger$ This relies on our knowing that the digits after the millionth digit of $n\log{n}$ are not an enormous string of $9$'s. In fact, the next digit is $0$ (since that is the millionth digit of $\log{10}$ after the decimal), justifying this step.

A similar approach as in the accepted answer, but using a tighter bound from Dusart ...

Theorem: If $m$ is a positive integer, then the first $k-1$ digits of the $10^{10^m}$th prime are just those of $\log 10$, where $k$ is the greatest integer such that $(k \le \lfloor m - \log_{10} m \rfloor \wedge d_k \lt 9)$, and $d_k$ is the $k$th digit of $\log 10$.

Proof: Rosser proved that $p_n \gt n \log n$, and Dusart proved that $p_n \le (n \log n)(1 + r_n)$ for all $n \ge 39017$, where $r_n = \frac{\log \log n - 0.9484}{\log n} \gt 0$. Therefore,

$p_n = n \log n + (n \log n) \ \epsilon_n$ for all $n \ge 39017$, where $0 \lt \epsilon_n \le r_n$.

Now suppose $n = 10^{10^m}$, where $m$ is a positive integer ($m \ge 1$ ensures $n \ge 39017$, so Dusart's bound applies). Then

$n \log n = 10^{10^m + m} \log 10$

which, in base $10$, is just $\log 10$ with the decimal point shifted $10^m + m$ places to the right.

Now $\log \log 10 < 0.9484$, so

$r_n = 10^{-m} \ (m + \frac{\log \log 10 - 0.9484}{\log 10}) < 10^{-m} m \le 10^{-\lfloor m - \log_{10} m \rfloor}$,

and hence

$(n \log n) \ \epsilon_n < (n \log n) \ 10^{-\lfloor m - \log_{10} m \rfloor}$

where the right-hand side is seen to be, in base $10$, just $n \log n$ with the decimal point shifted $\lfloor m - \log_{10} m \rfloor$ places to the left.

Thus, if $k$ is the greatest integer satisfying both (1) $k \le \lfloor m - \log_{10} m \rfloor$, and (2) the $k$th digit is less than 9 (ensuring that no carry from the right can affect the $(k-1)$th digit), then adding $(n \log n) \ \epsilon_n$ to $n \log n$ does not affect the first $k-1$ digits of the latter term. QED

NB: This result generalizes to the $b^{b^{m}}$th prime, for any integer base $b$ such that $2 \le b \le 13$, and for integer $m \ge \log_b \log_b 39017$. The restrictions are to ensure that Dusart's bound can be applied.

Example: For any $m \ge 10^6 + 8$ (e.g., $m = 10^{10}$, as in the posted question), the first million digits of the $10^{10^m}$th prime are just those of $\log 10$. This is because for $m = 10^6 + 8$, $\lfloor m - \log_{10} m \rfloor = 10^6 + 1$, giving $k$ as the greatest integer such that $(k \le 10^6 + 1 \wedge d_k \lt 9)$. Direct computation (e.g., using Sage, which took less than a minute) shows that $k-1 = 10^6$, $d_{k-1} = 5$, $d_k = 0 \ (\lt 9)$.