Determine the number of terminating zeroes in 8 0 0 0 !
Note:
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.
That's correct! I upvoted your solution (+1). Could you explain (in your solution) why this algorithm works? Why have we chosen powers of 5?
I have a two line answer without too much calculation.
v p ( n ) = p − 1 n − S p ( n ) .
This formula states that highest power of prime p in n is given by above statement.
S p ( n ) is sum of digits of n in base p .
In our case, n = 8 0 0 0 , p = 5 . So 1 9 9 8 is our answer, as simple as that.
Can you please elaborate it a bit more? I don't understand it quite well
5 ∣ 8 0 0 0
5 ∣ 1 6 0 0
5 ∣ 3 2 0
5 ∣ 6 4 *
5 ∣ 1 2 *
a b 2
*All the divisions above are integer divisions.
1 6 0 0 + 3 2 0 + 6 4 + 1 2 + 2 = 1 9 9 8
Note: This is no different from the process described in the GIF wiki except that it's faster, looks good, and takes less space.
⌊ 5 8 0 0 0 ⌋ + ⌊ 5 ² 8 0 0 0 ⌋ + ⌊ 5 ³ 8 0 0 0 ⌋ + ⌊ 5 ⁴ 8 0 0 0 ⌋ + ⌊ 5 5 8 0 0 0 ⌋
= 1 6 0 0 + 3 2 0 + 6 4 + 1 2 + 2
= 1 9 9 8
This wiki from contest maths has got more details.
This looks better:
− 5 8 0 0 0 5 1 6 0 0 5 3 2 0 5 6 4 5 1 2 2
Problem Loading...
Note Loading...
Set Loading...
For such questions divide the number continuously by powers of 5 less than the number itself and then sum all the quotients.
Thus sum of quotients is 1998.