Factorial Calculator
Calculate n! step by step
Factorial
—
Related Calculators
Frequently Asked Questions
What is a factorial?
n! (n factorial) is the product of all positive integers from 1 to n. Example: 5! = 5 x 4 x 3 x 2 x 1 = 120. Special case: 0! = 1 by definition. Factorials grow extremely fast: 20! = 2,432,902,008,176,640,000.
Why is 0! = 1?
0! = 1 is defined (not derived) to make combinatorics work correctly. C(n,0) = n!/(0! x n!) = 1/1 = 1, meaning there is exactly 1 way to choose 0 items from n. Without 0!=1, the combination formula would break down at boundaries.
How fast do factorials grow?
Extremely fast: 1!=1, 5!=120, 10!=3,628,800, 15!=1.3 trillion, 20!=2.4 quintillion. At n=70, n! exceeds the number of atoms in the observable universe (~10^80). Standard 64-bit integers overflow at 21!. Python handles arbitrarily large integers.
What are factorials used for?
Combinatorics: C(n,r) = n!/(r!(n-r)!), P(n,r) = n!/(n-r)!. Probability: arranging n items = n! ways. Power series in calculus: e^x = sum(x^n/n!). Statistics: binomial coefficients. Physics: Stirling approximation for large n.
What is Stirling approximation?
For large n: ln(n!) ≈ n*ln(n) - n + 0.5*ln(2*pi*n). Or n! ≈ sqrt(2*pi*n) * (n/e)^n. This approximation is accurate to < 1% for n > 10 and gets more accurate as n grows. Useful when exact computation is infeasible.
Key Factorial Facts
Applications of Factorials
| Formula | Use |
|---|---|
| C(n,r) = n!/(r!(n-r)!) | Combinations |
| P(n,r) = n!/(n-r)! | Permutations |
| e^x = Σ x^n/n! | Euler number |
| sin(x) = x - x^3/3! + ... | Taylor series |
| n! ≈ (n/e)^n √(2πn) | Stirling approx. |