The factorial of a non-negative integer n is the product n × (n−1) × (n−2) × ... × 1. By convention, 0! = 1.
Common Values
1!=1, 2!=2, 3!=6, 4!=24, 5!=120, 6!=720, 7!=5040, 10!=3,628,800, 20!=2.43×10¹⁸
Uses
- Permutations: nPr = n!/(n−r)!
- Combinations: nCr = n!/[r!(n−r)!]
- Probability: Counting arrangements and outcomes
- Taylor series: e^x = Σ(x^n/n!)
Why Factorials Grow So Fast
Factorial growth outpaces exponential growth for large enough n — 20! is already over 2 quintillion, and 100! has 158 digits, far exceeding the number of atoms in the observable universe (~10⁸²). This explosive growth is exactly why brute-force approaches to problems like the traveling salesman problem become computationally impossible past a small number of items.
Stirling's Approximation
For very large n, computing n! exactly becomes impractical, so mathematicians use Stirling's approximation: n! ≈ √(2πn) × (n/e)ⁿ. It's remarkably accurate even for moderately sized n and is widely used in statistics and physics where exact factorials of large numbers would otherwise be needed.