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

$e^\pi-\pi\approx 19.99909998$

Why is this so close to $20$?

• by chance (6 more to go...) – Jimmy R. Mar 24 '14 at 15:51
• It's not close at all. There are infinitely many numbers closer than that. – Asaf Karagila Mar 24 '14 at 16:15
• Obligatory link: xkcd.com/217 – Eric Lippert Mar 24 '14 at 17:26
• This isn't particularly close IMHO, it's almost .01% off. Given how many different "special" formulas crop up, you'd expect some of them to be at least this close to an integer. – Alex Becker Mar 24 '14 at 18:48
• The $0$ at $10^{-4}$ removes any relevance of the $9998$ that follows... – Ring Ø Jan 3 '16 at 14:50

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.

• It's probably no accident that this is the very same S. Plouffe who coined the name "Ramanujan Constant" for the almost-integer $e^{\pi\sqrt{163}}$. – Roland Jan 14 '16 at 10:26
• well now this answer has exactly 20 upvotes, no approximation necessary – Alex Sep 30 '16 at 10:59

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.

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

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.0004$.

• This is a really nice answer ! Thanks for providing it. – Claude Leibovici Jan 5 '16 at 11:04

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.

The right question is why

$$e^\pi-\pi\approx 20-\frac{1}{1111+\frac{1}{11+\frac{1}{\sqrt{2}}}}$$

• Hmmmm.... ${}{}$ – Mr Pie Mar 27 '18 at 10:12

As much as I wish there was some deep connection here, all (lack of) evidence points to the fact that this is nothing but mere, brilliant mathematical coincidence.

• There are actually quite some examples where some operations on transcedental numbers turn out to be extremely close to an integer. Maybe something good for a new post? – imranfat Mar 24 '14 at 16:00
• @imranfat maybe a post on a list of coincidences. – Guy Mar 24 '14 at 16:05
• @Sabyasachi There are some that aren't coincidences, such as $e^{\pi\sqrt{163}}$ as Geoff mentions. This one is though, IMHO. – Alex Becker Mar 24 '14 at 18:50
• @AlexBecker okay I wasn't aware of that. – Guy Mar 24 '14 at 18:57
• you could perhaps argue that nothing is a coincidence, and in time some weird area of number theory (perhaps alien to what we know today) will give this some better explanation than just "coincidence" – frogeyedpeas Jan 4 '16 at 4:10

If you think that's good agreement, try Ramanujan's constant $e^{\pi \sqrt{163}}.$ There is a deep explanation for the proximity in that case though.

If $e^\pi-\pi\approx20$ then $e^x-x-20$ must have a root around $x=\pi$. Hence the function defined by $z=e^{f(z)}-f(z)-20$ should pass $f(0)\approx\pi$. So with the Lagrange Inversion Theorem, we can find a series representation for $f(z)$. If there's any special reason why $f(0)\approx\pi$, it would explain why $e^\pi-\pi\approx20$. We can find $f(z)$ by inverting $e^x-x-20$ at $x=3$, as follows. *

$$f(z)=3+\frac{[z-(e^3-23)]}{e^3-1}-\frac{e^3[z-(e^3-23)]^2}{(e^3-1)^3\cdot 2!}+\frac{(e^3+2e^6)[z-(e^3-23)]^3}{(e^3-1)^5\cdot 3!}\ldots$$

If we substitute $z=0$ and simplify the series, our question is equivalent to asking why: $$3+\sum_{n=1}^{+\infty}\frac{(23-e^3)^np_n(e^3)}{(e^3-1)^{2n-1}(2n-1)!}\approx\pi$$

Where $p_n(e^3)$ are polynomials in $e^3$. Indeed we see that the left hand side is approximately $3.1416$. This is expected since solving $e^x-x-20=0$ gives us $x\approx 3.141\,633\,302\,801\,037$.

Figure: $\color{red}{y=e^x-x-20}$ in red, $\color{blue}{y=x}$ in blue, $\color{purple}{y=f(x)}$ in purple and the partial sum for $\color{green}{y=f(x)}$ up to $n=3$ in green. The purple curve represents the reflection of the red curve over the line $y=x$. The purple curve crosses the $y$ axis around $(0,\pi)$, implying $e^\pi-\pi\approx20$. Geogebra link: https://www.desmos.com/calculator/nhbpehuuds

### Potential Next Steps

The coefficients of $e^{3k}$ for each $p_n(e^3)$ are shown in the table below. For example, when $n=3$, $p_3(e^3)=e^3+2e^6$.

$$\begin{array}{|c|c|c|c|c|} \hline n&\text{Coefficient of }e^3&e^6&e^9\\ \hline 1&0&0&0\\ \hline 2&-1&0&0\\ \hline 3&1&2&0\\ \hline 4&-1&-8&-6\\ \hline \end{array}$$

If you think you can see any particular pattern in the table, or would like to calculate more entries, it could poetntially lead to an explanation.

We could also attempt to compare the terms in the series to a series for $\pi$. Namely $f(0)=3+0.153-0.0123+0.00135-0.000169\ldots$. We could narrow our search to the series for $\pi$ with the same rate of convergence. I think this series has first order convergence.

* We can't invert $e^x-x-20$ around $x=0$ because the derivative is $0$ here. I tried at $x=1$ but couldn't get it to work.

## protected by NosratiJul 20 '18 at 11:45

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).