Number of zeroes

Find the number of zeroes at the end of 9999 ! 9999! .

Clarification

For example, for 12 ! = 479 , 001 , 600 12! = 479,001,600 the answer would be 2 2 because if we look at the end there is a chain of 2 2 zeroes


The answer is 2495.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

E 5 ( 9999 ! ) = 9999 5 + 9999 25 + 9999 125 + 9999 3125 + 9999 15625 + E_5(9999!) = \lfloor \frac{9999}{5}\rfloor + \lfloor \frac{9999}{25}\rfloor + \lfloor \frac{9999}{125}\rfloor + \lfloor \frac{9999}{3125}\rfloor + \lfloor \frac{9999}{15625}\rfloor\ + \cdots

E 5 ( 9999 ! ) = 1999 + 399 + 79 + 15 + 3 + 0 = 2495 E_5(9999!) = 1999 + 399 + 79 + 15 + 3 + 0 = \boxed{2495}

For the first addend in the second equation, did you mean to write 1999 1999 , not 2399 2399 ?

Ralph James - 5 years, 2 months ago

Log in to reply

Yeah I'm sorry typing mistake. I've fixed that now

Aditya Narayan Sharma - 5 years, 2 months ago
Arulx Z
Mar 24, 2016
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n = int(raw_input())
c = 5

r = n // c

count = 0

while r > 0:
    count += r
    c *= 5
    r = n // c

print count

Tom Engelsman
Nov 26, 2020

The number of trailing zeros in 9999 ! 9999! is computed per:

9999 5 = 1999 1999 5 = 399 399 5 = 79 79 5 = 15 15 5 = 3 < 5 \lfloor \frac{9999}{5} \rfloor =1999 \Rightarrow \lfloor \frac{1999}{5} \rfloor = 399 \Rightarrow \lfloor \frac{399}{5} \rfloor = 79 \Rightarrow \lfloor \frac{79}{5} \rfloor = 15 \Rightarrow \lfloor \frac{15}{5} \rfloor = 3 < 5

Thus, we have 1999 + 399 + 79 + 15 + 3 = 2495 1999 +399 + 79 + 15 + 3 = \boxed{2495} trailing zeros.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...