Factorials grow faster than almost anything else, so they are often replaced by an approximation. The Stirling approximation calculator takes a whole number n and gives Stirling’s estimate of n!, the corrected estimate, the exact value, the relative error and the number of digits.
How the calculation works
- Enter a whole number n from 1 to 170.
- The Stirling approximation is n! ≈ √(2πn) × (n ÷ e)ⁿ. It replaces the product of n numbers with a smooth formula.
- A more accurate version multiplies the result by (1 + 1 ÷ (12n)), which cuts the error to a small fraction of its size.
- The calculator compares both with the exact value and shows the relative error of the basic formula and the number of digits of n!.
Example
For n = 15 the exact value is 15! = 1,307,674,368,000. Stirling gives √(30π) × (15 ÷ e)¹⁵ ≈ 1,300,430,722,199, which is 0.554 % too low. With the 1 ÷ 180 correction, the estimate is about 1,307,655,000,000, and the number has 13 digits.
Why it matters
Students of probability, statistics and statistical physics meet Stirling’s formula often. Seeing the estimate next to the exact value shows how quickly it becomes accurate and why it works so well for the huge numbers in those fields. It is also a good way to build intuition about how fast factorials grow, since each step multiplies the result by a larger number. It is also a good way to build intuition about how fast factorials grow, since each step multiplies the result by a larger number.
Good to know
The approximation is asymptotic, so it improves as n grows but is poor for very small n. For exact work with moderate n, use the exact factorial. Values above about 170! overflow ordinary floating-point numbers, so this calculator stops there.
Related tools
The Taylor series calculator uses factorials, and the combinations calculator uses factorials to count selections.