# Solution to $2^x=x!$

I was trying to solve the equation for $$x!=2^x$$, where $$x\ge0$$.

I plotted it on Desmos and found two solutions for the same.

Attaching image for reference. Graph plot of $$2^x$$ and $$x!$$

As per the plot, there are two solutions for the equation. But I am only able to derive the solution $$x=0$$. (Through observation and guesswork).

How can the second solution be derived ($$x\approx3.46$$)?

I couldn't figure it out!

It looks so simple, yet its quite a bummer actually(at least for me).

• Though the second solution is not 3.46, but a real number between 3.459 and 3.460. A computer helped me determine that. Commented Nov 4, 2022 at 3:41
• Giving far too many decimals, the second solution is $x = 3.45986564404499913418786108106898120\dots$ according to Wolfram Alpha. Commented Nov 4, 2022 at 3:46
• I think we can not go out of an numerical method for this problem or re writing the problem as a integral representation $\Gamma(x+1)=2^{x}$, for $x\geqslant 0$. Commented Nov 4, 2022 at 3:54
• The second solution is quite close to $4e/\pi$. Coincidence?
– Dan
Commented Nov 4, 2022 at 4:06
• @Dan probably coincidence, as it is accurate to only the second decimal digit. Commented Nov 4, 2022 at 4:14

I cannot see any form of analytical solution possible to this equation. Instead, you can set a function $$f(x)=2^x-\Gamma(x+1)$$ and perform numerical methods for the second solution. You can use Newton's method for approximating roots.

Here, we start with the initial value $$x=3$$

and so on to the desired accuracy.

The root we get is $$x\approx 3.45986564404499913418786108106898120277518459906428314529806887...$$

• Then there is another question along the similar lines... $1/x!=1/2^(x-1). This one has a solution at x=2. Is there any way to compute it analytically, or it needs to be solved through numerical methods as helped out by you? Commented Nov 4, 2022 at 4:06 • @lumberjack$1/x!=1/2^{x-1}$is rewritten as$2^x=2\Gamma(x+1)\$, which although cannot be solved analytically, has only two positive solutions that can be spotted via some intuitive insight. (ie 1 and 2) Commented Nov 4, 2022 at 4:11

Looking at this old question of mine, you will find a superb approximation proposed by @robjohn (one of our moderators) for the solution of the general equation $$\large x!=a^x$$

$$x\sim e a\exp\Bigg[W\left(-\frac{\log (2 \pi a)}{2 e a}\right)\Bigg]-\frac 12$$ where $$W(.)$$ is Lambert function.

To show how good it is

$$\left( \begin{array}{ccc} a & \text{approximation} & \text{solution} \\ 2 & 3.44447 & 3.45987 \\ 3 & 6.00778 & 6.01604 \\ 4 & 8.60960 & 8.61488 \\ 5 & 11.2347 & 11.2390 \\ 6 & 13.8753 & 13.8786 \\ 7 & 16.5270 & 16.5296 \\ 8 & 19.1868 & 19.1892 \\ 9 & 21.8531 & 21.8552 \\ 10 & 24.5245 & 24.5263 \\ 11 & 27.2001 & 27.2018 \\ 12 & 29.8792 & 29.8807 \\ 13 & 32.5613 & 32.5626 \\ 14 & 35.2459 & 35.2472 \\ 15 & 37.9327 & 37.9339 \\ 16 & 40.6214 & 40.6225 \\ 17 & 43.3119 & 43.3129 \\ 18 & 46.0038 & 46.0048 \\ 19 & 48.6971 & 48.6980 \\ 20 & 51.3917 & 51.3925 \\ \end{array} \right)$$

• It is a nice answer! Commented Nov 4, 2022 at 5:54

Let $$f(x) =2^{x}-x!$$.

We can see that $$f(0)=0$$ which implies $$0$$ is a root of $$f(x)$$.

Now we can see $$f(3) > 0$$ and $$f(4) < 0$$.

So by intermediate value theorem we can say that it has a root in between $$3$$ and $$4$$.

To find the approximated root we can use numerical approach. Better to use bisection method.