Factorials in simple words
A factorial means multiplying a whole number by every whole number below it, down to 1. It is written with an exclamation mark: 5! is said “five factorial”.
Example: 5! = 5 × 4 × 3 × 2 × 1. Step by step, 5 × 4 = 20, 20 × 3 = 60, 60 × 2 = 120 and 120 × 1 = 120. So 5! = 120.
Factorials count how many ways you can put things in order. Three friends can stand in a line in 3! = 3 × 2 × 1 = 6 different ways.
Factorials grow very fast. 10! is already 3,628,800, which is why the calculator also shows how many digits the answer has.
Definitions
n! = n × (n − 1) × … × 2 × 1, and 0! = 1 because it is an empty product. In terms of the gamma function, n! = Γ(n + 1).
A multifactorial counts down in steps of k: n!(k) = n × (n − k) × (n − 2k) × …, stopping at the last positive term. The double factorial n!! uses k = 2, so 7!! = 7 × 5 × 3 × 1 = 105 and 8!! = 8 × 6 × 4 × 2 = 384. It is not the same as (n!)!.
Worked example
20! = 20 × 19 × … × 1 = 2,432,902,008,176,640,000. That is 19 digits with 4 trailing zeros, or about 2.432902008 × 10¹⁸.
100! has 158 digits. By Legendre's formula it has ⌊100/5⌋ + ⌊100/25⌋ = 24 trailing zeros, because each zero needs a factor of 5 paired with a factor of 2.
Exact arithmetic and limits
Every digit is computed with exact integer arithmetic; nothing is rounded. When the result is too long for the headline, the headline shows scientific notation and the table below lists every digit, with a CSV download. The limit of n = 5,000 (a 16,326-digit answer) keeps the page fast.