What is a factorial (n!)
Updated on June 30, 2026 · by Rafael Rossi
The factorial of a number, written n! ("n factorial"), is the product of all positive integers from 1 to n. It's a cornerstone of combinatorics.
How to calculate
n! = n × (n−1) × (n−2) × … × 2 × 1
Example: 5! = 5 × 4 × 3 × 2 × 1 = 120. And since 4! = 24, you can reuse: 5! = 5 × 4!.
Why 0! = 1
It looks odd, but there's exactly one way to arrange "nothing" (the empty list), so 0! = 1 by definition. It also keeps combination and permutation formulas consistent.
Where factorials appear
- Permutations: how many ways to order n distinct items? Exactly n!. Ordering 5 books: 5! = 120.
- Combinations: C(n,k) uses factorials to count groups regardless of order.
- Probability and math series (like the one for e).
It grows staggeringly fast
Factorials explode: 10! already exceeds 3.6 million and 20! passes 2 quintillion.
FAQ
Is there a factorial of a negative or decimal? Not in the basic sense. For those, math uses the gamma function, a generalization of the factorial.