1

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?

Taha Akbari
  • 3,559
  • 1
    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? –  Jul 28 '16 at 16:38
  • I think the mean counting the number of 0's in the string $25!= 15511210043330985984000000$. –  Jul 28 '16 at 16:38
  • @T.Bongers Yikes! You think? I doubt there is a good general way of doing that...though, as you point out, this particular case is fairly easy to handle directly. – lulu Jul 28 '16 at 16:39
  • 2
    @lulu You should find all the zeros not just the end zeros. – Taha Akbari Jul 28 '16 at 16:39
  • @TahaAkbari Got it. That sounds hard. Wolfram alpha (or other sources) can certainly handle the raw computation....don't see a more elegant way to proceed. – lulu Jul 28 '16 at 16:40
  • @TahaAkbari This is easy to do numerically, but I don't know of any nice patterns. For example, $1000!$ is a 2568 digit number in which zero occurs 472 times. (Computed in a few milliseconds in python) –  Jul 28 '16 at 16:43
  • This depends on base-10 arithmetic coincidences, so I doubt that there is any reasonable formula. I could not find this in OEIS. – marty cohen Jul 28 '16 at 16:52
  • 1
    @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 Answers2

3

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.

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

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}$

Piquito
  • 29,594