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:


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 Akbari Jul 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.

  • 1
    $\begingroup$ 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? $\endgroup$ – lulu Jul 28 '16 at 16:37
  • $\begingroup$ You need to count all the zeros, not just the ones at the end? $\endgroup$ – tilper Jul 28 '16 at 16:38
  • $\begingroup$ I think the mean counting the number of 0's in the string $25!= 15511210043330985984000000$. $\endgroup$ – user296602 Jul 28 '16 at 16:38
  • 2
    $\begingroup$ @lulu You should find all the zeros not just the end zeros. $\endgroup$ – Taha Akbari Jul 28 '16 at 16:39
  • 1
    $\begingroup$ @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. $\endgroup$ – almagest Jul 28 '16 at 17:17

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


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

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

Thanks to Python.

  • $\begingroup$ Depending on the system, this will break once $n$ is large because the recursion limit will be hit. I'd suggest a loop instead. $\endgroup$ – 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}$


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