The factorial – basics and applications
From the definition to combinatorics and probability theory
The factorial n! (read "n factorial") is the product of all positive integers from 1 to n. The values grow extremely fast: 5! = 120, 10! = 3,628,800, 20! ≈ 2.43 × 10¹⁸ – that exceeds the number of seconds since the Big Bang. No wonder the factorial is so important in combinatorics: it counts the number of ways to arrange (permutations) n distinguishable objects.
The most important example: how many ways are there to seat 5 people at a table? The first person can sit in 5 chairs, the second in 4 remaining ones, and so on. That gives 5 × 4 × 3 × 2 × 1 = 5! = 120. The same logic applies to permutations in statistics, sequencing optimization (the travelling salesman problem) and calculating binomial coefficients: (n choose k) = n! / (k! × (n−k)!).
The special case 0! = 1 is defined by mathematical convention and follows from the recursion formula n! = n × (n−1)!: for n = 1, 1! = 1 × 0! = 1, so 0! must equal 1. It also makes intuitive sense: there is exactly one way to arrange zero elements – the empty arrangement. Without this convention, formulas like the binomial coefficient would not work for k = 0 and k = n.
In probability theory, the factorial determines how many outcomes are possible when drawing without replacement. If 6 numbers are drawn out of 49 (lottery), the number of possibilities is calculated with the binomial coefficient (49 choose 6) = 49! / (6! × 43!) ≈ 13,983,816. The huge numbers arise because factors like 49! become astronomically large but largely cancel out in the fraction. Our calculator computes factorials iteratively using exact integer arithmetic (BigInt), delivering digit-exact results for all inputs up to 170.