Factorial Calculator
Exact factorials up to 10,000! with every digit, digits and trailing zeros up to a billion!, and permutations and combinations (nPr, nCr).
Answer
- Digits
- 68
- Zeros at the end
- 12
- Worked out exactly in whole-number arithmetic: every digit is right.
- The zeros at the end come from the factors of 5 in 1 × 2 × … × n, each paired with a 2.
80658175170943878571660636856403766975289505440883277824000000000000
Numbers
How is this calculated?
n! = 1 × 2 × … × n, with 0! = 1 · nPr = n! ÷ (n − r)! · nCr = n! ÷ (r! (n − r)!) · With repeats: nʳ and (n + r − 1)Cr · Trailing zeros = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …Runs in your browser — nothing you enter leaves this device.
About this tool
What it does
This calculator works out n factorial — n! = 1 × 2 × 3 × … × n — exactly, with every digit, for any n up to 10,000 (a number 35,660 digits long). For larger n, up to one billion, it gives how many digits n! has and how many zeros it ends with. A second mode counts permutations and combinations: how many ways there are to arrange or to choose r things from n, with or without repeats.
How to use it
- Choose n! for a factorial, or Permutations and combinations.
- Type n. For a factorial, the answer shows the leading digits and the power of ten, with every digit in the box below to copy or download.
- For permutations and combinations, type n (how many there are) and r (how many are chosen).
- Turn on "The same item can be chosen more than once" when repeats are allowed, as with the digits of a PIN.
Limits and your data
- Every digit is shown up to 10,000!. Past that the number is too long to be useful written out, so only its digit count and trailing zeros are given, up to 1,000,000,000!.
- The digit count of a very large factorial is worked out from logarithms. If the logarithm lands too close to a whole number for a 15-digit float to be sure, the page says it is not certain rather than give a count that might be one out.
- Permutations and combinations take n and r up to 10,000, and are exact.
- Factorials are for whole numbers from 0 up. The gamma function, which extends them to fractions, is not covered here.
- It all runs in this page on your device. Nothing is sent anywhere or saved, and it works offline once loaded.
Questions
Why is 0! equal to 1?
There is exactly one way to arrange nothing: do nothing. It also keeps the rules consistent: n! = n × (n − 1)!, so 1! = 1 × 0!, which needs 0! to be 1, and it makes nCr give 1 for choosing all or none.
What is the difference between a permutation and a combination?
In a permutation the order matters; in a combination it does not. A race with 10 runners has 10P3 = 720 ways to fill gold, silver and bronze, but only 10C3 = 120 ways to pick which three runners get a medal.
How many ways can a deck of cards be shuffled?
52!, about 8.07 × 10^67. That is so large that a well-shuffled deck is almost certainly in an order no deck has been in before.
How do you count the zeros at the end of a factorial?
Each trailing zero needs a factor of 10, that is a 2 and a 5. There are always more 2s than 5s, so count the 5s: every multiple of 5 gives one, every multiple of 25 one more, and so on. 100! has 20 + 4 = 24 zeros.
How many lottery combinations are there in 6 from 49?
49C6 = 13,983,816, so a single ticket has about a one in fourteen million chance of matching all six numbers.