Why is $e^\pi - \pi$ so close to $20$?

It cannot be accidental in the real sense. It is either special or typical. Observe that in almost all such equations it is always something else in disguise. For example, in many cases you can reduce numbers to their rational approximations and explicitly check everything.

Instead of just using approximation, you can find some simpler connection and argue about extreme values or something that is going to give you a common reason for the equation.

One of the examples of this procedure is given in: Prove $\left(\frac{2}{5}\right)^{\frac{2}{5}}<\ln{2}$

and I will illustrate here how we can check your statement above using the simple approximation of $\pi \approx \sqrt{10}$. This is probably not sufficient on its own for immediate success but it gives you the flavor of the method, and it gives you some estimation to work around, especially, it specifically explains that it is not $e$ or $\pi$ in many similar equations, it is just something that looks like it.

So the equation we are interested in becomes

$$y^{\sqrt{x}}-\sqrt{x}=20$$

The solution is of course

$$y=(\sqrt{x}+20)^{\frac{1}{{\sqrt{x}}}}$$

We can expand it around 0 and get

$$(\sqrt{x}+20)^{\frac{1}{{\sqrt{x}}}} = e^{\frac{1}{{\sqrt{x}}}\ln{(\sqrt{x}+20)}} \approx e^{\frac{\ln(20)}{\sqrt{x}}+\frac{1}{20}-\frac{\sqrt{x}}{800}+...}$$

For the sake of simplicity we will ignore the terms beyond $-\frac{\sqrt{x}}{800}$ and simply try to solve

$$\frac{\ln(20)}{\sqrt{x}}+\frac{1}{20} = 1 $$

This gives

$$x=\frac{400\ln{20}^2}{361}$$

Well now it is easy

$$\frac{400\ln{20}^2}{361} \approx \frac{400\ln{20}^2}{360}=10(\frac{\ln{20}}{3})^2$$

and now comes the simple part $\ln(20)=2.995 \approx 3$ making $(\frac{\ln{20}}{3})^2 \approx 1$ and $x \approx 10$ as expected which is the key reason for the equation itself.

This is all telling you that you are right, but something is still missing.

What remains is to justify the remainder.

$$e^{\pi}-\pi=e^3 \cdot e^{\pi-3}-\pi=20$$ $$20 e^{\pi-3}-\pi \approx 20$$ $$e^{\pi-3}\approx 1+\frac{\pi}{20}$$

I hope that you can see the game here. $0.14$ is still small enough for reasonable estimation of $e^{\Delta{x}}=1+\Delta{x}$ and at the same time $$\frac{\pi}{20} \approx 0.15 \approx \pi - 3$$

So this last part is essentially $$e^{\pi-3}\approx 1+\pi-3 \approx 1+\frac{\pi}{20}$$

As you can see the equation in question is not much more than a game of two combined "accidents" $\ln(20) \approx 3 \; \; \; (1)$ and $\frac{\pi}{20} \approx \pi - 3 \; \; \; (2)$

We can establish a strict form and write

$$e^{3+x}-(3+x)=e^3$$

This has a nice solution in form of Lambert function

$$x=-W_{-1}(-e^{-e^3})-3-e^3 \approx 0.1454$$

but this is just rephrasing all what we have said already.

The key reason for the entire conundrum is obviously $$-W_{-1}(-e^{-e^3})-e^3 \approx \pi$$

Observe that the true nature of it is given by the approximations (1) and (2). This last is just all that at more sophisticated level. Still it has not much to do with $\pi$ itself, just with its value, as strange as this may sound.

You may ask, ok, but why do we have $\ln(20) \approx 3$? That is strange on its own. You can approach this by using some series for $e^x$ and argue about the zeros or you can again use something like

$$\frac{e^{x+1}}{5x}-x$$

and find that this has a minimum around $x=1.99...$ since it is achieved for $e^{x+1}(x-1)=5x^2$ and even just by looking at it you can see that $x \approx 2$ providing $e^3 \approx 20$ or the other way around.

I would truly consider the approximate thing of $e^{\pi}-\pi \approx 20$ as very much solved by this analysis.

For some reason unknown to me, it will not be that fast to find this or some derived explanation around the Internet. It can't be all that there is to it, can it?

Unless you want to add a factor or two more to justify maybe one digit more it is indeed all that there is to it: $\ln(20) \approx 3$ and $\frac{\pi}{20} \approx \pi-3$

(The reason I have used $\sqrt{10}$ for $\pi$ is to have something to check the estimations without going more close to the value of $\pi$ itself. Using $\sqrt[3]{31}$ we can achieve somewhat better accuracy but that is not completely necessary at first.)

If you are still in doubt simply draw an implicit graph $y(x)$ of

$$e^{x(1+\frac{1}{e^{y}})}-x(1+\frac{1}{e^{y}})-e^{y}=0$$

and notice how fast after 1 it becomes very close to $y(x)=x$. As an exercise you may even try to find derivative of this function.

enter image description here

In that sense this has not much to do with $\pi$ itself, it is something else in disguise.

Few additional notes:

Since we got very close, I will explain the final steps leading more precisely to the approximation. We start from

$$e^{3+x}-(3+x)=e^3$$

and realize that $e^3$ is a little bit larger than $20$. We rewrite it all as

$$e^{3+x}-(3+x)=e^{3-y}$$

and now all values are small so we can use linear approximation getting

$$(e^{3+x}-1)\mathrm{d} x=-e^{3-y}\mathrm{d} y$$

which makes

$$\mathrm{d} y = -\frac{(e^{3+x}-1)}{e^{3-y}}\mathrm{d} x$$

or with all things we know so far it is

$$\mathrm{d} y \approx -\frac{22}{20}\mathrm{d} x$$

We would like to reduce $x$ by about $0.003899$, which requires increasing y by about

$$\frac{22}{20}0.003899=0.0042889$$

Notice now that $3-\ln(20)=0.00426...$ almost precisely the figure we need in order to reach $20$ from $e^3$. Regardless of this last precision details, we could say that we are by chance almost as close to $\ln(20)$ in one case as we are to $\pi$ in another. This is not what is creating the approximation completely, this last is just adding a digit or two to the result because it can.

These last details are somewhat self-regulating since we are using linear approximations that are adding by themselves a digit or two more and the functions used are constantly some sort of $e^x$ so the needed ratio remains. What looks like some sort of chance (or design) is that all figures are sufficiently and relatively precisely close to each other so that we can use linear approximations and confirm that they are even closer.

Last but not least is indeed magic. Once we have reached a proximity of probably below fifth or sixth decimal digit, we allow ourselves a little bit of trickery. Imagine, we have the result of 19.9999999 for some value close to $\pi$, but in order to reach $\pi$ more closely we need 19.9992. We would totally allow this and still be surprised since our sense of being close allows a final margin of error to be just anything. In essence this is a trick since we are actually forcing the result close to what we want at the expense of enlarging the error.

You can find a similar magical effect on many even very serious sources which claim instead of the above that $\cos(\ln(\pi+20)) \approx 1$. $\cos$ is reducing the error around $1$ making the result even more "surprising", but unless this form is supported by some deeper theory, it is advisable to keep the form so that the surprising integer effect is lowered. (The form $\cos(\ln(\pi+20))$ is probably not going into the right direction since even $\cos(\ln(\pi+21))$ or $\cos(\ln(\pi+19))$ is "close" to 1 then.)

Far from being a complete trick, these almost integers are hiding some properties of the constants we know so well, which we would not be aware of otherwise.


All the above is saying why we have these two numbers so close, but it does not say if the situation is special in any particular way. If you run a simulation of around the same size random numbers, minimizing the value $av_{1}+bv_{2}+c$ you will notice that this behavior together with the error term below 0.001 is typical, you find about one or two solutions that use integers, $a,b,c$ in the range $[-25,25]$.

The fact that we have one large integer of 20 is another strong indication that there is no special linear relation between $e^{\pi}$ and $\pi$ that is not within the same rank of two average random numbers in the same range. For example, the testing shows that if there is more than one solution the average of integers employed is lower, and for our case $\frac{20+1+1}{3} \approx 7$ is just about right for the numbers that have one integer connection for the given margin of 0.001. There is no statistical evidence, if you want, that points to any special connection, which is to say that there could be as many as you like without any indication over which one is more correct.

(Of course the situation is simple enough to check all this using the probability theory, but for the moment we were quite happy with the simulation.)


This above is an illustration of the method. It gives the flavor. A full account actually goes over the function

$$-x-W_{-1}(-\frac{1}{e^{x}})$$ which is a solution for $y$ of $e^y-y=x$

We start from $x_{0}=e^3-3 \approx 17$ because $-x_{0}-W_{-1}(-\frac{1}{e^{x_{0}}})=3$

and we want to get to

$$-20 -W_{-1}(-\frac{1}{e^{20}}) \approx 3.1416 \approx \pi$$

We expand $-x-W_{-1}(-\frac{1}{e^{x}})$ around $e^3-3$ getting

$$-20-W_{-1}(-\frac{1}{e^{20}})=3+\frac{23-e^3}{e^3-1}-\frac{e^3(23-e^3)^2}{2(e^3-1)^3}+$$ $$\frac{e^3(23-e^3)^3(1+2e^3)}{6(e^3-1)^5}-\frac{e^3(23-e^3)^4(1+8e^3+6e^6)}{24(e^3-1)^7}+$$ $$\frac{e^3(23-e^3)^5(1+22e^3+58e^6+24e^9)}{120(e^3-1)^9}... $$ getting with first 5 terms $3.14163...$ only to realize that except at first few digits the value has no recognizable connection with $\pi$ itself.

If we make a crude assumption that $e^3 = 20 $ we have that the value is $$\approx 3+\frac{3}{19}-\frac{9\cdot 20}{2\cdot 19^3}+\frac{27\cdot 820}{6\cdot 19^5}-...$$ which nicely explains the logic we have been trying to follow in the text considering the structure of the value of $\pi$.

Another options is to have it all expanded around $x_{0}=20-\ln(20)$, because $-W_{-1}(-\frac{1}{e^{x_{0}}})=20$. And now you need only $\ln(20) \approx 3$ to express the approximation to $\pi$.

$$-20-W_{-1}(-\frac{1}{e^{20}})=\ln(20)+\frac{\ln(20)}{19}-\frac{10\ln^2(20)}{19^3}+\frac{410\ln^3(20)}{3\cdot 19^5}$$ $$-\frac{12805 \ln^4(20)}{6\cdot 19^7}+\frac{215641 \ln^5(20)}{6\cdot 19^9}-\frac{22884241 \ln^6(20)}{36\cdot 19^{11}}+...$$

Finally if you expand around $x_{0}=e^\pi - \pi$ since $-x_{0}-W_{-1}(-\frac{1}{e^{x_{0}}})=\pi$ you have even the error term in a more precise form:

$$-20-W_{-1}(-\frac{1}{e^{20}})=\pi+\frac{20+\pi-e^{\pi}}{e^{\pi}-1}-\frac{e^{\pi}(20+\pi-e^{\pi})^2}{2(e^{\pi}-1)^3}+...$$

And the second term defines the error since the third is already $\sim 10^{-9}$, $\frac{20+\pi-e^{\pi}}{e^{\pi}-1} \approx 0.00004$.


You may find :

This curious near-identity was apparently noticed almost simultaneously around 1988 by N. J. A. Sloane, J. H. Conway, and S. Plouffe, but no satisfying explanation as to "why" $e^\pi-\pi \simeq 20$ is true has yet been discovered.

after some googling.


The proximity to $\pi$ is purely coincidental, as is often the case. Take for instance the root of the equation $x^4+x^5=e^6$, which is $x=\pi+0.000 000 029$. Many other far more accurate yet equally coincidental approximations are shown on this page: http://www.contestcen.com/pi.htm.

For each of these coincidences, one could be surprised and wonder: "Why is it so close? ". This is a naive question because a particular relationship is especially selected to be close to an exact value and chosen among an infinity of relationships more or less approximated.

One can find very easily as many coincidences as we want, with $\pi$ or/and with other usual constants, thanks to computer automatic search. The general principle of the method is described with examples in the paper "Mathématiques expérimentales" published on Scribd (in French): http://www.scribd.com/JJacquelin/documents.