I am curious on where the factorial $x!=\Gamma(x+1)$ passes the exponential $e^x$ for $x>0$. I first tried using Lambert $W$ and the inverse of Stirling's approximation by @Gary. Call $p$ the point at which the factorial passes the exponential. $$p=e^x\ \text{and}\ p=x!$$ The first can easily be evaluated as $x=\log(p)$ and using the Lambert $W$ function, the latter is (work by Gary) $$x = \frac{{\log \left( {\frac{p}{{\sqrt {2\pi } }}} \right)}}{{W\left( {\frac{1}{e}\log \left( {\frac{p}{{\sqrt {2\pi } }}} \right)} \right)}} - \frac{1}{2} $$ for sufficiently large $p$. Equating the two we obtain, $$\log(p) = \frac{{\log \left( {\frac{p}{{\sqrt {2\pi } }}} \right)}}{{W\left( {\frac{1}{e}\log \left( {\frac{p}{{\sqrt {2\pi } }}} \right)} \right)}} - \frac{1}{2}$$ but I can't continue further. I tried using the gamma function as well but failed to come up with anything significant. Any ideas? Thanks in advance.
-
1$x=0$ obviously works – Thomas Andrews Mar 31 '23 at 13:59
-
1Other than that, not everything has a closed form. The largest real solution is between $5$ and $6,$ but I'd be surprised if there was a closed form. – Thomas Andrews Mar 31 '23 at 14:02
-
@ThomasAndrews. You are right, that will work. I am curious of the other intersection though. – bob Mar 31 '23 at 14:02
-
Alpha gives about $5.2903$ as a numeric result. It doesn't offer an exact form. – Ross Millikan Mar 31 '23 at 14:07
-
@RossMillikan. I've observed that too. I guess if wolfram can't find it, there probably is no closed form? – bob Mar 31 '23 at 14:11
-
It isn't a guarantee-there might be an approach it missed, but it is a good indication. – Ross Millikan Mar 31 '23 at 14:33
-
You can try Newton's method with $x_0=\ln200$ and $f(x)=\frac{e^{x}}{x!}-1$ – Miss and Mister cassoulet char Mar 31 '23 at 14:33
2 Answers
If you look here, you will find a superb approximation built by @robjohn. Applied to your problem $$x!=e^x \qquad \implies \qquad \color{blue}{x\sim \exp\left(2+ W\left(-\frac{\log (2 e \pi )}{2 e^2}\right)\right)-\frac 12}$$ which is $5.28081$ that is to say in a relative error of $0.18$%.
Now, using Newton-like methods of order $n$ for finding the zero of function $$f(x)=\log(x!)-x$$, the first iteration is still explicit and easy to obtain since $$\big[\log(x!)]^{(n)}=\psi ^{(n-1)}(x+1)$$
So, the results $$\left( \begin{array}{ccc} n & \text{first estimate} & \text{method} \\ 2 & \color{red}{5.2903}264120457478491 & \text{Newton} \\ 3 & \color{red}{5.2903160}763059627349 & \text{Halley} \\ 4 & \color{red}{5.2903160931}486923581 & \text{Householder} \\ 5 & \color{red}{5.2903160931197}199474 & \text{no name} \\ 6 & \color{red}{5.290316093119770}8007 & \text{no name} \\ 7 & \color{red}{5.290316093119770710}6 & \text{no name} \\ \cdots & \cdots & \\ \infty & \color{red}{5.2903160931197707107} & \text{solution} \\ \end{array} \right)$$ showing for the absolute error $$\log_{10}(|\text{error}|_n)=0.5158964 - 2.760374 \,n$$ Notice that the slope is $\sim -e$.
Edit
Making the problem more general $$x!=e^{k x}\qquad \implies \qquad \large\color{blue}{x_{(k)}\sim \exp\left(k+1 +W\left(-\frac {k+\log (2 \pi ) }{2 e^{k+1} }\right)\right)-\frac 12}$$
Some results $$\left( \begin{array}{ccc} k & \text{approximation} & \text{solution} \\ 1 & 5.28080609982 & 5.29031609313 \\ 2 & 17.5609484230 & 17.5635286436 \\ 3 & 51.6222027742 & 51.6230410442 \\ 4 & 144.964737552 & 144.965029854 \\ 5 & 399.495201639 & 399.495306705 \\ 6 & 1092.20718395 & 1092.20722222 \\ 7 & 2976.03576673 & 2976.03578075 \\ 8 & 8097.66349482 & 8097.66349997 \\ 9 & 22020.5461895 & 22020.5461914 \\ 10 & 59867.7224841 & 59867.7224841 \\ \end{array} \right)$$
For $k=10$, the absolute error is $6.96\times 10^{-7}\qquad \color{red}{\large \text{(!!)}}$
Asymptotically, $$x_{(k+1)} \sim e\,x_{(k)}$$ which is already clear looking at the numbers in the table.

- 260,315
-
-
@ClaudeLeibovici. The link takes me to Gary's answer. Where can I find @robjohn's? – bob Apr 01 '23 at 02:39
-
@bob. Sorry ! It has been fixed. For the fun, look at the edit. Cheers :-) – Claude Leibovici Apr 01 '23 at 03:20
-
@ClaudeLeibovici. That's some impressive results! Always appreciate your work Claude. Cheers! – bob Apr 01 '23 at 03:47
-
1@bob. Thanks for the nice words but I did not do anything beside using robjohn superb approximation. Cheers & thanks for the nice problem. – Claude Leibovici Apr 01 '23 at 03:52
-
@ClaudeLeibovici. If I may ask, what software do you use to compute these values? The calculators I use have no where near the accuracy you obtain. – bob Apr 01 '23 at 04:05
-
-
@ClaudeLeibovici. For example,
$$\left( \begin{array}{ccc} k & \text{approximation} & \text{solution} \ 1 & 5.28080609982 & 5.29031609313 \ 2 & 17.5609484230 & 17.5635286436 \ 3 & 51.6222027742 & 51.6230410442 \ 4 & 144.964737552 & 144.965029854 \ 5 & 399.495201639 & 399.495306705 \ 6 & 1092.20718395 & 1092.20722222 \ 7 & 2976.03576673 & 2976.03578075 \ 8 & 8097.66349482 & 8097.66349997 \ 9 & 22020.5461895 & 22020.5461914 \ 10 & 59867.7224841 & 59867.7224841 \ \end{array} \right)$$
– bob Apr 01 '23 at 04:21 -
Though an analytical solution can't be given, an approximate solution using the Lambert $W$ function can be derived by following the general steps taken by @robjohn. Start by using a slightly modified version of Stirling's formula, $\log(x!)\sim x\log(x)-x+\frac{1}{2}\log(2\pi x)$. $$\begin{align*} \log\left(\frac{e^x}{x!}\right) & \sim x-\left(x\log(x)-x+\frac{1}{2}\log(2\pi x)\right) \\ & =2x-x\log(x)-\frac{1}{2}\log(2\pi x) \\ & =-x\log\left(\frac{x}{e^2}\right)-\frac{1}{2}\log(2\pi x) \end{align*}$$ To solve the equation above for $x$ using the Lambert $W$, first multiply both sides by $-1/e^2$ to get, $$\begin{align*} -\frac{1}{e^2}\log{\left(\frac{e^x}{x!}\right)}\sim\frac{x}{e^2}\log{\left(\frac{x}{e^2}\right)}+\frac{1}{2e^2}\log(2\pi x) \end{align*}$$then subtracting $\frac{1}{2e^2}\log\left(2\pi e^2\right)$, $$\begin{align*} -\frac{1}{e^2}\log{\left(\frac{e^x}{x!}\right)}-\frac{1}{2e^2}\log\left(2\pi e^2\right)&\sim\frac{x}{e^2}\log{\left(\frac{x}{e^2}\right)}+\frac{1}{2e^2}\log(2\pi x)-\frac{1}{2e^2}\log\left(2\pi e^2\right) \\ -\frac{1}{e^{2}}\log\left(\frac{\sqrt{2\pi}e^{x+1}}{x!}\right)&\sim\frac{x}{e^2}\log{\left(\frac{x}{e^2}\right)}+\frac{1}{2e^2}\log\left(\frac{x}{e^2}\right) \\ &=\frac{2x+1}{2e^2}\log\left(\frac{x}{e^2}\right) \\ &\sim \frac{2x+1}{2e^2}\log\left(\frac{2x+1}{2e^2}\right)-\frac{1}{2e^2} \end{align*}$$hence, we end up with a form which can be expressed with the Lambert $W$ function, defined as $z=W(z)e^{W(z)}$ for $z>0$. $$\begin{align*} -\frac{1}{e^2}\log\left(\frac{\sqrt{2\pi}e^{x+1/2}}{x!}\right)&\sim\frac{2x+1}{2e^2}\log\left(\frac{2x+1}{2e^2}\right) \\ &=\log\left(\frac{2x+1}{2e^2}\right)\exp\left(\log\left(\frac{2x+1}{2e^2}\right)\right) \end{align*}$$Applying the Lambert $W$ function and solving for $x$, $$x\sim e^2\exp\left(W\left(-\frac{1}{e^2}\log\left(\frac{\sqrt{2\pi}e^{x+1/2}}{x!}\right)\right)\right)-\frac{1}{2}$$substituting $\log\left(e^x/x!\right)=0$ yields the final expression,$${x\sim e^2\exp\left(W\left(-\frac{\log\left({2\pi e}\right)}{2e^2}\right)\right)-\frac{1}{2}}.$$

- 2,167