Factorial Calculator (n!)
First 20 Factorials
| n | n! | Approx. |
|---|
Factorial Calculator – What Is n! and How to Use It
The factorial of a non-negative integer n, written as n!, is the product of all positive integers from 1 to n. Our free online factorial calculator computes n! for any integer from 0 to 170 instantly, shows the result in full (for small values) and scientific notation, and displays the number of digits in the result.
Factorial Definition and Examples
n! = n × (n−1) × (n−2) × … × 2 × 1
- 0! = 1 (by definition — the empty product)
- 1! = 1
- 5! = 5 × 4 × 3 × 2 × 1 = 120
- 10! = 3,628,800
- 20! = 2,432,902,008,176,640,000
Factorials grow extremely fast. 100! has 158 digits, and 170! ≈ 7.26 × 10³⁰⁶ — the largest factorial that fits in a JavaScript 64-bit float.
Why Is 0! Equal to 1?
There are several ways to understand this. The most intuitive: n! counts the number of ways to arrange n distinct items (permutations). There is exactly one way to arrange zero items (do nothing), so 0! = 1. Mathematically, the recursive definition n! = n × (n−1)! requires 1! = 1 × 0!, and since 1! = 1, we get 0! = 1.
Applications of Factorials
- Permutations: The number of ways to arrange n distinct items = n!
- Combinations: C(n, k) = n! / (k! × (n−k)!) — choosing k items from n.
- Probability: Card game, lottery, and sampling calculations.
- Taylor series: e^x = Σ xⁿ/n! — factorials appear in infinite series expansions.
- Binomial theorem: (a+b)^n expansion coefficients involve n!.
- Computer science: Factorial is a classic recursive algorithm example.
Factorial Growth Rate
Factorials grow faster than any exponential function. By Stirling's approximation: n! ≈ √(2πn) × (n/e)^n. This is why even modest values of n produce astronomically large factorials, and why the number of possible arrangements (permutations) of a deck of 52 cards — 52! ≈ 8 × 10⁶⁷ — exceeds the number of atoms in the observable universe.
