How many zeros are there in $ 25!$ ? My answer was $6$. But i solved it by finding how many numbers are divisible by $5$ and $2$.here i was told to find out the zeros at the last end. But what is the method which is more accurate and can find out the number of zeros in eg $1000!$ or $10000!$ in the following cases: 1.Just at the last end 2.In the number altogether Or even the general method of finding the number of zeros in n! ?
-
2related: number of zero digits in factorials – Angela Pretorius Jul 07 '13 at 06:17
-
1In the number altogether is unlikely to have a nice formula. The end zeroes is much much much easier, precisely because the number of end zeros has an algebraic interpretation. – Thomas Andrews Jul 07 '13 at 06:37
-
http://mathoverflow.net/questions/102092/number-of-zeroes-in-100-factorial – Asinomás Jul 07 '13 at 06:50
-
@All: Sorry, this is probably a better duplicate target. Even better ones may be out there. – Jyrki Lahtonen May 05 '19 at 05:16
2 Answers
The number of zeroes depends on how many times the number is divisible by 10. $10=2*5$, and there will always be an excess of 2s, so find out how many times $n!$ is divisible by 5. IE. $5!$ has 1 zero, because $1*2*3*4*5$ is divisible by 5 one times. $10!$ has 2 etc. So you might think $n!$ has $\lfloor n/5 \rfloor$ zeroes. But this is wrong, because $25/5$ = 5, but $25!$ has 6 zeroes. This is because $25 = 5^2$. Now you know that every number divisible by 25 adds additional zero. And again every number divisible by 125 adds additional zero.
So the number of zeroes is found by first finding the largest $k$ such that $n > 5^k$ but $n < 5^{k+1} $. Then you sum $\sum_{j=1}^k \lfloor n/5^j \rfloor$. This should have the number you want.
Example: 860! would have $\sum_{j=1}^4 \lfloor 860/5^j \rfloor$ = 213 zeroes. Using mathematica and counting the zeroes, this is easily confirmed.
This obviously is for trailing zeroes. For general use the the method in the post linked in the comment linked above.

- 3,154
25! number of zeroes at the end in such cases you have to count number of 5's and 10's in the factorial.
For smaller number it is easy in 25! 5's are in 5,15, 25 total number of 5's = 1(5) + 1(15) + 2(25) = 4 10's are in 10 and 20 = 1(10) + 1(20) = 2 total zeroes at the end = 4 + 2 = 6
For greater number, say for example 250!
find quotient(s) till it is less than 5 in 250/5 = 50, 50/5 = 10, 10/5 = 2,
add all quotients 50 + 10 + 2 = 62

- 3

- 351