Factorial Calculator
Compute the factorial n! — the product of all integers up to n — with the number of digits and trailing zeros, for any n from 0 to 170.
Cómo usar esta calculadora
- 1Enter a whole number n between 0 and 170.
- 2Read n!, the product of every integer from 1 to n.
- 3See how many digits it has and how many trailing zeros.
- 4For large n the value is shown in scientific notation, since it's too big to write out.
Cómo funciona
Factorial
n! = n × (n − 1) × (n − 2) × … × 2 × 1 0! = 1 by definition (the empty product) n! = n × (n − 1)! (recursive form) trailing zeros of n! = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …
The factorial of a whole number n, written n!, is the product of every positive integer from 1 up to n. So 5! is 5 × 4 × 3 × 2 × 1 = 120. It can be defined recursively — each factorial is n times the previous one — which is why factorials build so quickly. Zero factorial is defined to be 1, not because you multiply nothing, but because that is the only value that keeps the combinatorial formulas that use factorials consistent; it represents the single way to arrange an empty set. Factorials count arrangements: n! is exactly the number of different orders in which n distinct objects can be placed, which is why they are the foundation of permutations, combinations, and much of probability. Their growth is staggering — faster than any exponential — so even modest values of n produce enormous numbers, and beyond 170 the result exceeds what a standard computer number can hold.
Ejemplo resuelto
5! = 5 × 4 × 3 × 2 × 1 = 120, which is the number of ways to arrange five distinct books on a shelf. The growth is dramatic: 10! is already 3,628,800, and 20! exceeds 2.4 quintillion — from just twenty factors.
Factorial Calculator: la guía completa
What a factorial counts
A factorial is easiest to understand not as a piece of arithmetic but as a count of arrangements. If you have n distinct objects and want to know how many different orders you can put them in, the answer is exactly n!. For the first position you have n choices; for the second, n − 1 remain; for the third, n − 2; and so on down to the last, which has just one. Multiplying these choices together gives n × (n − 1) × … × 1 — the factorial. This is why 5! = 120 is the number of ways to seat five people in a row, or order five songs in a playlist.
This counting interpretation is what makes factorials so central to combinatorics and probability. The number of permutations of a set, the arrangements of letters in a word, the possible orderings of a deck of cards — all are factorials. A standard deck has 52! possible orderings, a number so vast (around 8 × 10⁶⁷) that essentially every well-shuffled deck in history has been in an order never seen before. The factorial turns the abstract idea of 'how many ways' into a single, if rapidly enormous, number.
Explosive growth and its limits
Factorials grow faster than exponential functions, and their pace surprises people. Doubling n does far more than square the result. 10! is about 3.6 million, but 20! is already 2.4 quintillion, and 100! has 158 digits — a number vastly larger than the count of atoms in the observable universe. This ferocious growth is why factorials appear whenever the number of possibilities in a problem explodes with its size, and why brute-forcing arrangement problems becomes impossible almost immediately.
The growth also imposes a practical ceiling. A standard double-precision computer number can only represent values up to roughly 1.8 × 10³⁰⁸, and 170! is the largest factorial that fits — 171! overflows to infinity. This is why the calculator caps n at 170 and switches to scientific notation well before then, since writing out the hundreds of digits of a large factorial exactly requires special big-number arithmetic. The digit count grows steadily even when the exact figure cannot be shown, which is why it is reported separately.
Trailing zeros and a glimpse of deeper structure
One elegant question about factorials is how many zeros they end in, and the answer reveals hidden structure. A trailing zero comes from a factor of 10, which is a 2 times a 5. In any factorial there are always more factors of 2 than of 5, so the number of trailing zeros is governed entirely by how many factors of 5 the product contains. Counting them gives a neat formula: add up n divided by 5, plus n divided by 25, plus n divided by 125, and so on, taking the whole-number part each time.
So 100! ends in 24 zeros, because among the numbers 1 to 100 there are 20 multiples of 5 and 4 multiples of 25, each contributing an extra factor of five. This kind of result is a small window into number theory, showing how the prime factorisation of a factorial can be reasoned about without ever computing the giant number itself. Factorials, for all their simplicity of definition, connect to permutations, probability, the gamma function that extends them to non-integers, series expansions in calculus, and results like this one — which is why such an elementary idea keeps reappearing across mathematics.
Preguntas frecuentes
What is a factorial?
The factorial of a whole number n, written n!, is the product of all positive integers up to n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. It counts the number of ways to arrange n distinct objects in order, which is why it's fundamental to permutations and probability.
Why is 0! equal to 1?
By convention, because it's the only value that keeps the combinatorial formulas consistent — there is exactly one way to arrange zero objects (the empty arrangement). It's also the empty product, and defining 0! = 1 makes formulas for permutations and combinations work without special cases.
How fast do factorials grow?
Faster than any exponential. 10! is about 3.6 million, 20! exceeds 2.4 quintillion, and 100! has 158 digits. This explosive growth is why factorials cap out quickly on computers — 170! is the largest that fits a standard number, and 171! overflows.
How many trailing zeros does a factorial have?
The count of factors of 5 in the product, found by adding ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …. So 100! ends in 24 zeros. There are always more factors of 2 than 5, so the fives alone determine the trailing zeros.