Factorials count orderings and appear in nearly every counting formula. The factorial calculator takes a whole number n and gives n!, the double factorial n!!, the number of trailing zeros and the number of digits of n!.
How the calculation works
- Enter a whole number n from 0 to 170.
- The factorial is n! = n × (n − 1) × … × 2 × 1, with 0! defined as 1. It counts the ways to put n distinct items in order.
- The double factorial n!! multiplies every second number: n × (n − 2) × (n − 4) × … down to 2 or 1.
- Trailing zeros come from factors of 10, and each needs a 2 and a 5. There are always more 2s than 5s, so the count is ⌊n ÷ 5⌋ + ⌊n ÷ 25⌋ + ⌊n ÷ 125⌋.
Example
For n = 10, 10! = 10 × 9 × … × 1 = 3,628,800. The double factorial is 10 × 8 × 6 × 4 × 2 = 3,840. The number has 7 digits and 2 trailing zeros, since 10 ÷ 5 = 2 and there are no multiples of 25.
Why it matters
Students of probability, algebra and computer science use factorials for permutations, combinations and series. Knowing the digits and the trailing zeros is a classic exercise, and a quick tool saves long multiplications. The double factorial also appears in formulas for the volume of spheres, in series expansions and in some counting problems.
Good to know
Factorials above about 20 exceed the exact range of ordinary integers, and this calculator uses floating-point arithmetic, so large results are rounded. The tool stops at 170, because 171! is beyond the largest number a double can hold.
Related tools
The combinations and permutations calculators use factorials to count selections and orderings.