Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

One common math puzzle I've seen around asks for how many zeros are in the product of "100!"

Usually, the solution everyone gives goes something like try to match pairs of 5s and 2s that factor out of the numbers, which ends up being 24 zeroes (you can factor a 5 out of 20 of the numbers, and factor 2 5s out of 4 of the numbers; you can factor more than 24 2s out).

This however as far as I know gives the number of trailing zeroes at the end of the number, but does not account for the zeroes that are within the number. My question is, is this answer correct anyways? Can there be zeroes that aren't trailing that are inside? Why or why not and if there can be can we somehow figure out how many are within the product?


share|improve this question
I am not aware of any way to predict the number of non-trailing zeros in $n!$, other than by calculating n! and counting them. –  Robert Israel May 7 '12 at 7:41
See also oeis.org/A137581 –  Robert Israel May 7 '12 at 7:47
According to WolframAlpha it would be $29$ zeros in $100!$ (trailing $24$ and $5$ zeroes inside), but if you are looking for a method, as Robert Israel said, there is no known method. –  Kirthi Raman May 7 '12 at 11:22
I would expect that for large $n$ about one-tenth of the digits should be zero, simply because there's no good reason to expect otherwise. The number of digits of $n!$ can be estimated very well by Stirling's formula. –  Gerry Myerson Jul 7 '12 at 5:26
@robjohn, 100 is not large. –  Gerry Myerson Jul 7 '12 at 11:42

2 Answers 2

For a prime $p$, let $\sigma_p(n)$ be the sum of the base-$p$ digits of $n$. Then the number of factors of $p$ that divide $n!$ is $$ \frac{n-\sigma_p(n)}{p-1} $$

There are $24$ trailing zeroes in $100!$. Since $100_{\text{ten}}=400_{\text{five}}$, there are $\frac{100-4}{5-1}=24$ factors of $5$ in $100!$.

However, there are $6$ other zeros that occur earlier, making the total $30$:

$933262154439441526816992388562667\color{#C00000}{00}49\color{#C00000}{0}71596826438162146859296389$ $52175999932299156\color{#C00000}{0}894146397615651828625369792\color{#C00000}{0}82722375825118521\color{#C00000}{0}$ $916864\color{#C00000}{000000000000000000000000}$

share|improve this answer
Counting the amount of zeroes from the explicit form kind of kills the point of doing your first observation. –  Listing Jul 7 '12 at 11:50
@Listing: It does, but I had written the first part before I pulled out Mathematica to compute $100!$. I left it in because I like the formula, and because I used it in a comment to lab bhattacharjee's answer. –  robjohn Jul 7 '12 at 14:01
would the downvoter care to comment? –  robjohn Jul 25 '14 at 10:51

To form factor of zeros at the end, we need $5$. Thus, if $Z(n)$ is the number of zeros of $n!$ then $$ Z(100) = \frac{100}{5} + \frac{100}{5^2} = 20 + 4 = 24 \ \text{zeros} $$

share|improve this answer
The question is explicitly not about the trailing zeroes. (Indeed, 24 zeroes is in the problem statement itself.) –  Semiclassical Jul 25 '14 at 6:17

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.