August 27, 2026 at 18:52 Tags Math
The other day, I found myself wondering how big 52! (52 factorial) is, and that led me to ponder how these could be estimated without a calculator or a computer.
It turns out there’s some fairly interesting math behind being able to estimate the size (number of digits) of a factorial reasonably accurately. This post will start by stating how to do the estimate, and if you’re curious you can read on for the math background.
Without further ado, the approximation is:
\[\text{number of digits in n!}\approx n\log_{10}\left(\frac{n}{e}\right)+2\]
As an example, let’s use my original question, by estimating this for 52!
Well, 52 divided by e is... 20-ish? And \log_{10}(20) is about 1.3 ; therefore our estimate comes out to:
\[\text{number of digits in 52!}\approx 52\cdot 1.3 +2 \approx69\]
The real answer is 68, so this is very close! In estimates like this - when you’re dealing with enormous numbers - being off by a couple of digits usually isn't a big deal.
The Gamma function The Gamma function for real n>0 is defined as: \[\Gamma(n)=\int_{0}^{\infty}x^{n-1}e^{-x}dx\] This integral does not have an analytic expression in the general case, but it does have a very useful property that we can take advantage of. Let’s see what \Gamma(n+1) is: \[\Gamma(n+1)=\int_{0}^{\infty}x^{n}e^{-x}dx\] And now use integration by parts with: \[u=x^n\qquad v=-e^{-x}\] Then: \[du=nx^{n-1} dx\qquad dv=e^{-x}dx\] So: \[\begin{aligned} \Gamma(n+1)&=\int_{0}^{\infty}x^{n}e^{-x}dx\\ &=\left. -x^n e^{-x}\right|_{0}^{\infty}-\int_{0}^{\infty}-e^{-x}n x^{n-1}dx\\ &=n\int_{0}^{\infty}x^{n-1}e^{-x}dx \end{aligned}\] But notice that the last integral is just \Gamma(n) ; therefore, we’ve shown that: \[\Gamma(n+1)=n\Gamma(n)\] Let’s also calculate \Gamma(1) - it’s a special case that has an analytical solution: \[\Gamma(1)=\int_{0}^{\infty}e^{-x}dx=\left. -e^{-x}\right|_{0}^{\infty}=1\] This helps establish an induction argument: \[\begin{aligned} \Gamma(2)=1\cdot\Gamma(1)&=1!\\ \Gamma(3)=2\cdot\Gamma(2)&=2!\\ \Gamma(4)=3\cdot\Gamma(3)&=3!\\ \dots\\ \Gamma(n+1)=n\cdot\Gamma(n)&=n! \end{aligned}\] In other words - the Gamma function is an interpolation of the factorial over all positive reals. Here’s a plot of the Gamma function over a small range; note that the y axis is log-scale because of the function’s fast growth:
... continue reading