Solving $n! = 10^6$ for $n$

378 Views Asked by At

I am trying to solve $n! = 10^6$ for $n$. I thought to do this using the gamma function:

$$(n - 1)! = \Gamma(n) = \int_0^\infty x^{n - 1}e^{-x} \ dx$$

So I have that

$$\Gamma(n + 1) = \int_0^\infty x^n e^{-x} \ dx = 10^6$$

I thought to solve this using integration by parts:

$$\begin{align} \Gamma(n + 1) &= \int_0^\infty x^n e^{-x} \ dx \\ &= [-x^n e^{-x}]^{\infty}_0 + \int_0^{\infty} nx^{n - 1}e^{-x} \ dx \end{align}$$

But, as you can see, unless I have made a mistake, we get the term $\int_0^{\infty} nx^{n - 1}e^{-x} \ dx$, which, as far as I can tell, means that we get stuck in an infinite loop of integration by parts.

So how do I solve this?

Thank you.

2

There are 2 best solutions below

0
On BEST ANSWER

If you look at this question, you will find a very good approximation of the inverse of the factorial function.

Applied to your case $$n! =y$$it write

$$n \sim \frac{{\log \left( {\frac{y}{{\sqrt {2\pi } }}} \right)}}{{W\left( {\frac{1}{e}\log \left( {\frac{y}{{\sqrt {2\pi } }}} \right)} \right)}} -\frac{1}{2}$$ and, for $y=10^6$, it will give $n=9.44379$ while the exact solution is $9.44561$.

1
On

Using WolframAlpha, I get $n=9.4456089144163262435935599652$, but thats about as far as I can figure. There's not really a good way to reverse the Gamma function to solve something like that besides numerical approximations.