The behaviour of the first $n$ digits of ${\underbrace{99\dots99}_{n\text{ nines}}}^{\overbrace{99\dots99}^{n\text{ nines}}}$ as $n\to\infty$

decimal-expansionelementary-number-theoryfractional-part

For a natural number $n$, let $f(n)$ denote the first $n$ digits of the decimal expansion of $${\underbrace{99\dots99}_{n\text{ nines}}}^{\overbrace{99\dots99}^{n\text{ nines}}}=(10^n-1)^{10^n-1}.$$ So we have $10^{n-1}\le f(n)<10^n$. Then what can we say about $\lim_{n\to\infty} \frac{f(n)}{10^n}$ ?


For simplicity, let $y_n=(10^n-1)^{10^n-1}$. Then we have $$y_n=10^{\log_{10}(y_n)}=\underbrace{10^{\lfloor \log_{10}(y_n)\rfloor}}_{\text{integer}}\cdot 10^{\{ \log_{10}(y_n)\}},$$

where $\lfloor\cdot\rfloor$ denotes flooring and $\{\cdot\}$ denotes the fractional part.

So the first $n$ digits of $y_n$ are given by $$f(n)=10^{n-1}\cdot 10^{\{ \log_{10}(y_n)\}}.$$

Using this (somewhat) closed form, I can do numerical experiments in Mathematica, which suggest that $\lim_{n\to\infty}\frac{f(n)}{10^n}=\frac1e$:

enter image description here


Indeed, it would be enough to understand the bevahiour of $\{ \log_{10}(y_n)\}$ as $n\to\infty$.

Best Answer

I figured it out: We can indeed study the asymptotic behaviour of $f(n)$ using Taylor series:

Observe that $$\log_{10}(y_n)=(10^n-1)\cdot\log_{10}(10^n-1).$$ When I first saw this, I was tempted to write $$\log_{10}(y_n)=(10^n-1)\cdot\log_{10}(10^n-1)\approx(10^n-1)\cdot n.$$

Although this approximation is very tight, I am still making an error big enough such that the first $n$ digits of $10^{\text{approximation}}$ are completely different from those of $y_n$. (Indeed, the approximation just yields an integer power of $10$.)

However, there is an easy way to quantify the error in this approximation:

\begin{split}\log_{10}(y_n)&=(10^n-1)\cdot\left(\color{orange}{\log_{10}(10^n)}+\log_{10}(10^n-1)-\color{orange}{\log_{10}(10^n)}\right)\\ &=(10^n-1)\cdot\left(n+\log_{10}\left(1-\frac1{10^n}\right)\right)\\ &=(10^n-1)\cdot\left(n-\frac{10^{-n}}{\ln(10)}+O(10^{-2n})\right)\\ &=10^n n-\frac1{\ln(10)}-n+O(10^{-n}), \end{split}

where I am using the big $O$ notation as $n\to\infty$. (The second last equality is a series of the logarithm.)

It follows that $$y_n=10^{\log_{10}(y_n)}=10^{10^n n-n}\cdot 10^{-\frac1{\ln(10)}}\cdot10^{O(10^{-n})}.$$

Notice that $$10^{-\frac1{\ln(10)}}=\exp\left(-\frac{\ln(10)}{\ln(10)}\right)=\frac1e,$$ and that $10^{O(10^{-n})}$ converges to $1$ very quickly (in fact, the speed of convergence doesn't matter, $10^{O(10^{-n})}$ could be replaced by any function that converges to $1$.) So for $n$ large enough, we have $\frac1e 10^{O(10^{-n})}\in]0,1[$.

Since $10^{10^n n-n}$ is an integer power of $10$, it follows that the first $n$ digits of $y_n$ are $$\bbox[15px,border:1px groove navy]{f(n)=\left\lfloor \frac{10^n}{e}\cdot10^{O(10^{-n})}\right\rfloor.}$$

A corollary of this result is that $$\lim_{n\to\infty} \frac{f(n)}{10^n}=\frac1e.$$

Remark 1. We don't have to consider the first $n$ digits only. For example, we also have $$\lim_{n\to\infty} \frac{y_n}{10^{10^n-n}}=\frac1e$$ and I think that we could verbatim look at for example the first $2n$ digits of $y_n$. (Or, more generally, at the first $d(n)$ digits where $d(n)$ is a sequence of natural numbers that converges to $\infty$.)

Remark 2. My procedure indicates a rather rapid convergence: Indeed we have $10^{O(10^{-n})}=\exp(O(10^{-n})\ln(10))=1+O(10^{-n})$ so that $10^{O(10^{-n})}-1$ has an asymptotic error that behaves like $10^{-n}$.

Here is a plot of the ratio of $y_n$ and the approximation given above (i.e. this is a plot of the $10^{O(10^{-n})}$ term):

enter image description here