Factorial Table

Factorial values from 0! to 20!

nn!Value
00!1
1 1! 1
2 2! 2
3 3! 6
4 4! 24
5 5! 120
6 6! 720
7 7! 5,040
8 8! 40,320
9 9! 362,880
10 10! 3,628,800
11 11! 39,916,800
12 12! 479,001,600
13 13! 6,227,020,800
14 14! 87,178,291,200
15 15! 1,307,674,368,000
16 16! 20,922,789,888,000
17 17! 355,687,428,096,000
18 18! 6,402,373,705,728,000
19 19! 121,645,100,408,832,000
20 20! 2,432,902,008,176,640,000

What is a Factorial?

The factorial of a non-negative integer n, denoted n!, is the product of all positive integers less than or equal to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. By convention, 0! = 1 (the empty product). The factorial function grows extremely rapidly — 20! = 2,432,902,008,176,640,000 is already larger than what a 64-bit integer can hold for n = 21.

Combinatorics and Permutations

Factorials are fundamental in combinatorics. The number of ways to arrange n distinct objects in a line is n!. For example, there are 6! = 720 ways to arrange 6 books on a shelf. The number of ways to choose k items from n (the binomial coefficient) is n! / (k!(n−k)!). This appears in the binomial theorem, Pascal's triangle, and probability theory.

A permutation of n elements taken r at a time is P(n,r) = n!/(n−r)!. A combination is C(n,r) = n!/(r!(n−r)!). These formulas are the backbone of probability, statistics, and discrete mathematics. The number of ways to deal a 5-card poker hand from a 52-card deck is C(52,5) = 52!/(5! × 47!) = 2,598,960.

Growth Rate

The factorial function grows faster than any exponential function. While 210 = 1024, 10! = 3,628,800 — already much larger. Stirling's approximation provides a useful estimate: n! ≈ √(2πn) × (n/e)n. This formula is remarkably accurate even for small n and is invaluable in theoretical analysis.

The number of digits in n! is approximately n × log₁₀(n/e) + ½ × log₁₀(2πn). By 100!, the number has 158 digits. By 1000!, it has 2568 digits. Computing very large factorials requires arbitrary-precision arithmetic (big integer libraries).

Factorial in Calculus

Factorials appear prominently in Taylor series and Maclaurin series. The exponential function: ex = Σ xn/n! for n = 0 to ∞. The sine function: sin(x) = Σ (−1)n x2n+1/(2n+1)!. The cosine function: cos(x) = Σ (−1)n x2n/(2n)!. These infinite series converge for all real x, and the factorial in the denominator ensures convergence by making the terms shrink rapidly.

Generalizations

The gamma function Γ(n) = (n−1)! extends the factorial to non-integer and complex numbers. The double factorial n!! multiplies every other integer: 7!! = 7 × 5 × 3 × 1 = 105. The subfactorial !n counts derangements — permutations where no element remains in its original position. The superfactorial and hyperfactorial are even faster-growing generalizations.

Applications

Factorials are used in probability theory (probability distributions, Bayesian statistics), quantum mechanics (state counting), cryptography (key space calculations), and algorithm analysis (O(n!) represents the brute-force complexity of problems like the traveling salesman). Understanding factorials is essential for computer scientists and mathematicians alike.