# How to find a large factorial in scientific notation?

For example, given $8952!$, how do I write this in scientific notation?

-
You can use Stirling's approximation. – enzotib Sep 9 '12 at 20:55

Use Stirling’s approximation to as many terms as you need:

$$n!\approx\sqrt{2\pi n}\left(\frac{n}e\right)^n\left(1+\frac1{12n}+\frac1{288n^2}-\frac{139}{51840n^3}-\frac{571}{2488321n^4}+\ldots\right)\;.$$

The factor $\left(\frac{n}e\right)^n$ is already very large, so it’s easier to work with the approximation for $\ln n!$:

$$\ln n!\approx n\ln n-n+\frac12\ln(2\pi n)+\frac1{12n}-\frac1{360n^3}+\frac1{1260n^5}-\frac1{1680n^7}+\ldots\,.$$

I get $\ln 8952!\approx 72,513.37666589$; dividing by $\ln 10$, I get $\log_{10} 8952!\approx 31,492.15935017$, so $8952!\approx 10^{0.15935017}\times 10^{31492}\approx 1.443278591\times 10^{31492}$.

-

Without using Stirling's formula, it is easy enough to use $$\ln n! = \sum_{i=1}^{n} \ln i$$ and, as long as $n$ isn't too large (depending on how soon you want your answer), one can evaluate this sum directly with Mathematica, Maple, GP, etc.

With $n=8952$, GP tells me ( with the command "sum(i=1,8952,log(i))") $$\ln 8952! = 72513.37666589335322455704104$$ so 8952! $\approx 1.44327859093238883310 \times 10^{31492}$.

In fact, with GP, one can calculate 8952! exactly, and then simply apply a logarithm to put it into scientific notation. The results agree to the level of precision I gave above.

-