A factorial is the product of every whole number from one up to n, written n!. It counts the number of ways a set can be arranged: three books can sit on a shelf in 3! = 6 orders, and ten books in 3,628,800. That is the whole idea, and it is why factorials appear wherever arrangements, orderings or selections are being counted.
Factorials grow faster than almost anything else in elementary mathematics. 20! already exceeds two quintillion, and 70! overflows a standard double-precision float. Growth this steep is the reason brute-force approaches to ordering problems become impossible so quickly.
How fast it grows
| n | n! | Scale |
|---|---|---|
| 5 | 120 | Trivial |
| 10 | 3,628,800 | Millions |
| 15 | 1,307,674,368,000 | Trillions |
| 20 | 2.43 × 10¹⁸ | Exceeds a 64-bit signed integer |
| 52 | 8.07 × 10⁶⁷ | Orderings of a deck of cards |
| 70 | 1.20 × 10¹⁰⁰ | Larger than a googol |
Why 0! equals 1
There is exactly one way to arrange nothing — the empty arrangement — so 0! = 1 by definition, and it is not an arbitrary convention. It also falls out of the recurrence n! = n × (n−1)!: setting n = 1 gives 1! = 1 × 0!, which requires 0! to be 1. Defining it this way keeps the permutation and combination formulas working at their boundaries instead of needing special cases.
Permutations and combinations
- Permutations, where order matters: P(n,r) = n! ÷ (n−r)!. Choosing a first, second and third place from eight runners gives 336 outcomes.
- Combinations, where order does not: C(n,r) = n! ÷ (r!(n−r)!). Choosing three people from eight for a committee gives 56.
- The difference is the r! in the denominator, which divides out the orderings you do not want to count separately.
A number worth sitting with
A shuffled deck of 52 cards has 52! possible orders — about 8 × 10⁶⁷. That is more arrangements than there are atoms in our galaxy. Any deck you shuffle properly has, with overwhelming probability, never existed in that exact order before in human history. Factorial growth is the reason a statement that sounds like hyperbole is simply true.