hn.today

How Big Are Factorials?

eli.thegreenplace.net3 points1 comments
Screenshot of How Big Are Factorials?

This explains how to estimate how big n! is, focusing on the number of decimal digits, and gives a simple practical rule: number of digits ≈ n·log10(n/e) + 2. Using 52! as an example, the rule yields about 69 digits while the exact value has 68, so the estimate is very close for ordinary uses; when dealing with enormous numbers, being off by a digit or two is usually acceptable. The piece then develops the mathematical justification behind that convenient formula.

The justification starts with the Gamma function Γ(n) = ∫0^∞ x^{n-1} e^{-x} dx, whose recurrence Γ(n+1) = n Γ(n) and value Γ(1)=1 reproduce factorials on the integers. Rewriting n! as Γ(n+1), changing variables x = n y, and applying Laplace’s method to the integral with f(y)=ln y − y (maximum at y=1) produces Stirling’s approximation n! ≈ √(2πn)(n/e)^n. Taking base‑10 logarithms of Stirling yields the digits formula log10(√(2πn)) + n·log10(n/e); the first term is small but contributes about two extra digits for n up to roughly 1,600. Practical mental-log tips (e.g., log10 2 ≈ 0.3, log10 3 ≈ 0.5) make the estimate easy to use without a calculator.

Read on eli.thegreenplace.net1 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Other

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.