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.