How many digits of $\pi$ are needed to approximate $\pi^n$ correctly to the nearest whole number?

83 Views Asked by At

In his piece on $\pi^{\pi^{\pi^\pi}}$, Matt Parker plots a graph showing that if $\pi$ is approximated to $n$ digits, then whenever $m \leq 2 n$ (roughly), $\pi^m$ is correct to the nearest whole number.

Is there any theoretical underpinning for this?

3

There are 3 best solutions below

0
On

Suppose $p>0$ is an approximation of $\pi$ with error $\epsilon$ (say $\epsilon=|p-\pi|$). The first digit where $p$ and $\pi$ disagree is in the $10^{\lceil\log_{10}\epsilon\rceil}$'s column.

Now we can trivially bound the error between $\pi^n$ and $p^n$ since $$|p^n-\pi^n|=\epsilon \cdot \bigg(\sum_{k=0}^{n-1}p^{k}\pi^{n-k-1} \bigg) < \epsilon \cdot n \cdot \max(\pi,p)^{n-1}.$$ Thus they definitely agree up to the $10^{(n-1)\lceil\log_{10}(\epsilon n\max(\pi,p))\rceil}$'s column.

1
On

The difference between our approximation to $\pi^m$ and the true result is $$\left(\pi + \epsilon\right)^m - \pi^m \approx \pi^m m \epsilon \sim \frac{\pi^mm}{10^n}$$ where we have used $\epsilon \sim 10^{-n}$ since the error in $\pi$ is in the $n$th digit so $\epsilon \sim 10^{-n}$ and the approximation $(1+x)^m \approx 1+ mx$. Now $\pi^2 \approx 10$ so we will have $\frac{\pi^mm}{10^n} > 1$ when $m \gtrsim 2n$. If you want to be more precise then its $m \gtrsim \log(10) n/\log(\pi) \approx 2.011n$ for large $n$.

0
On

Starting from @Winther's answer, the only explicit solution of $$m\,\pi^m=10^{n}$$ is given by $$m=\left\lceil \frac{W\left(10^n \log (\pi )\right)}{\log (\pi )}\right\rceil$$ where $W(.)$ is Lambert function. In practice, $m$ is close to $2n$ (as already mentioned) but not sufficiently accurate.

For $n=50$, this would give $m=97$. Checking

$$97\, \pi^{97}-10^{50}=6.23 \times 10^{49} <10^{50}$$ while $$98\, \pi^{98}-10^{50}=4.15 \times 10^{50} >10^{50}$$ For large value of $x$, you can approximate the value of Lambert function by $$W(x)\approx L_1-L_2+\frac{L_2}{L_1}+\frac{L_2(L_2-2)}{2L_1^2}+\frac{L_2(2L_2^2-9L_2+6)}{6L_1^3}+\cdots$$ where $L_1=\log(x)$ and $L_2=\log(L_1)$.

Using this approximation for $n=50$ would give $$W\left(10^{50} \log (\pi )\right)\sim 110.55887520$$ while its exact value is $110.55887517$