Is there a way to solve for an unknown in a factorial?

A good approximation for $n!$ is that of Stirling: $n!$ is approximately $n^ne^{-n}\sqrt{2\pi n}$. So if $n!=r$, where $r$ stands for "really large number," then, taking logs, you get $\left(n+\frac12\right)\log n-n+\frac12\log(2\pi)$ is approximately $\log r$. Now you can use Newton's method to solve $\left(n+\frac12\right)\log n-n+\frac12\log(2\pi)=\log r$ for $n$.


$\exp(1+W(\log(n!)/e))-\frac{1}{2}\searrow n$ as $n\to\infty$where $W$ is the Lambert W function. For integer $n\ge2$, the floor is exact.

I just took the expansion out a bit more and the approximation I gave above overestimates $n$ by $\log\left(\sqrt{2\pi}\right)/\log(n)$.

Tags:

Factorial