# How many zeros are there in $25!$? [duplicate]

This question already has an answer here:

How many zeros are there in $25!$?

I don't know how to really calculate it the number of zeros in the right hand can easily find by Legendre's formula.

That gives us:

$\lfloor{\frac{25}{5}}\rfloor+\lfloor{\frac{25}{25}}\rfloor=5+1=6$

But I got stuck with finding the zeros between.Any hints?

## marked as duplicate by Jorge Fernández Hidalgo, joriki, Mike Haskel, Alex M., Taha AkbariJul 28 '16 at 18:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• Not following...you have correctly observed that $v_5(25!)=6$. As $v_2(25!)$ is certainly bigger than that, the answer must be $6$. Or have I misunderstood? – lulu Jul 28 '16 at 16:37
• You need to count all the zeros, not just the ones at the end? – tilper Jul 28 '16 at 16:38
• I think the mean counting the number of 0's in the string $25!= 15511210043330985984000000$. – user296602 Jul 28 '16 at 16:38
• @lulu You should find all the zeros not just the end zeros. – Taha Akbari Jul 28 '16 at 16:39
• @TahaAkbari Your question was how many. No one has come up with a better way than evaluating 25! explicitly and counting the zeros, so please accept the CW answer below if you are content, or explain why you are not. – almagest Jul 28 '16 at 17:17

## 2 Answers

25!=15511210043330985984000000, so the answer is 9 zeros. [Thanks to @T.Bongers]

Or:

def fact(n):
if n < 2:
return 1
else:
return n*fact(n-1)

print str(fact(25)).count('0')


Thanks to Python.

• Depending on the system, this will break once $n$ is large because the recursion limit will be hit. I'd suggest a loop instead. – user296602 Jul 28 '16 at 18:29

Your calculation gives the ended zeroes but for the other appearing in the decimal expression of $25!$ I think you have no other way that to get a such expression. The calculator of Windows gives $$15\space 511\space 210\space 043\space 330\space 985\space 984\space 000\space 000$$ hence you have $6+3=\color{red}{9}$