Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry, I'm not into advanced math, but it wonders me, why factorials above ~85! contain lots of zero's at the end.

Example, 100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000

share|cite|improve this question
85 is no benchmark. The higher you get the more 0's you will have. – user88595 Feb 10 '14 at 15:25
Yes, the question is why. – niklon Feb 10 '14 at 15:25
Solution below explains it well. It's all about powers of 2 and 5. – user88595 Feb 10 '14 at 15:26
Why'd you pick 85? Were the 19 zeros at the end of 84! below the "lots" cutoff? – user2357112 Feb 11 '14 at 3:01
Honestly, I picked it by accident. Because lower factorials didn't concern me that much, so I chose 85 as a milestone. – niklon Feb 11 '14 at 12:00
up vote 33 down vote accepted

A number ends in $m$ zeroes if and only if it is divisible by $10^m$. To be divisible by $10^m$ means to be divisible by $2^m$ and by $5^m$. Big factorials (nothing special about 85) are products of lots and lots of numbers. After a while, lots of those numbers are divisible by 2 (and powers of 2), and lots are divisible by 5 (and powers of 5), so the product is divisible by a really high power of 10. (For more precise mathematical statements about how many zeroes you'll get, search this site, where there are many variations on this question.)

share|cite|improve this answer
See also Legendre's formula. – Your Ad Here Feb 10 '14 at 15:32

It should be pretty obvious why $10!$ and all higher factorial must all have at least one zero at the end: they're all divisible by $10$.

$$10! = \mathbf{10} \times 9 \times 8 \times 7 \times 6 \times 5 \times 4 \times 3 \times 2 \times 1$$

If you think about it a bit more, it's also pretty obvious that $20!$ and any factorials above it must haveat least two zeros at the end (because they're divisible by $10 \times 20$) and that $30!$ and above must have at least three zeros (because they're divisible by $10 \times 20 \times 30$) and so on.

Actually, this "rule" underestimates the number of zeros at the end of factorials by about a factor of $2$. Why? Because $2 \times 5 = 10$, so $5! = 5 \times 4 \times 3 \times 2 \times 1$ already has one zero at the end, and every further multiple of $5$ adds yet another zero (there being plenty of even numbers to provide the multiples of $2$ needed to make up $10$). So $15!$ has three zeros at the end, not just one, and $20!$ actually has four, not two.

Also, $25!$ actually gains two extra zeros from being a multiple of $25 = 5 \times 5$, for a total of six. The same happens at $50!$ and $100!$, and $125!$ actually has three more zeros at the end than $124!$, because $125 = 5 \times 5 \times 5$.

So, looking at your example, we don't actually need to calculate $85!$ to tell that it has twenty zeros at the end: one each from $5$, $10$, $15$, $20$, $25$, $30$, $35$, $40$, $45$, $50$, $55$, $60$, $65$, $70$, $75$, $80$ and $85$, and one extra each from $25$, $50$ and $75$.

share|cite|improve this answer

First of all, you need to know that starting with $n = 5$, $n!$ will always have at least one zero in the end.
$5! = 5\times4\times3\times2\times1 = 120$. In this example, the $5$ and one $2$ contribute to that zero. After this, at $10!= 3628800$, another zero is added because the $5$ from the '10' and another $2$ from the product $10!$ contribute to the extra zero. Since the number of '2's in $n!$ will always be greater than number of $5$s, the number of zeroes at the end of $n!$ will be equal to the total number of 5s in the product $n!$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.