Factorial problem again !!

Determine the number of terminating zeroes in 8000 ! 8000!


Note:

  • 10000 has 4 terminating zeroes while 1000100 has only 2.
  • n ! = n × ( n 1 ) × ( n 2 ) × × 3 × 2 × 1. n! = n \times (n-1) \times (n-2) \times \cdots \times 3 \times 2 \times 1.


The answer is 1998.

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

Rajdeep Das
Jun 26, 2016

For such questions divide the number continuously by powers of 5 less than the number itself and then sum all the quotients.

  • 8000=5 * 1600 +0
  • 8000=25 * 320 +0
  • 8000=125 * 64 +0
  • 8000=625 * 12 +500
  • 8000=3125 * 2 +1750

Thus sum of quotients is 1998.

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?

Pranshu Gaba - 4 years, 11 months ago

Log in to reply

See http://www.purplemath.com/modules/factzero.htm

Ed Zeng - 3 years, 3 months ago
Priyanshu Mishra
Oct 15, 2016

I have a two line answer without too much calculation.

v p ( n ) = n S p ( n ) p 1 \large\ { v }_{ p }(n) = \frac { n - { S }_{ p }(n) }{ p - 1 } .

This formula states that highest power of prime p p in n n is given by above statement.

S p ( n ) { S }_{ p }(n) is sum of digits of n n in base p p .

In our case, n = 8000 , p = 5 n = 8000, p = 5 . So 1998 \boxed{1998} is our answer, as simple as that.

Can you please elaborate it a bit more? I don't understand it quite well

Scarecrow Nambiar - 3 years, 1 month ago

5 8000 5 \underline{|8000}

5 1600 5 \underline{|1600}

5 320 5 \underline{|320}

5 64 5 \underline{|64} *

5 12 5 \underline{|12} *

a b 2 \textcolor{#FFFFFF}{ab}2

*All the divisions above are integer divisions.

1600 + 320 + 64 + 12 + 2 = 1998 1600 + 320 + 64 + 12 + 2 = \boxed{1998}


Note: This is no different from the process described in the GIF wiki except that it's faster, looks good, and takes less space.

8000 5 + 8000 5 ² + 8000 5 ³ + 8000 5 + 8000 5 5 \lfloor \frac{8000}{5} \rfloor\ + \lfloor \frac{8000}{5²} \rfloor\ + \lfloor \frac{8000}{5³} \rfloor\ + \lfloor \frac{8000}{5⁴} \rfloor\ + \lfloor \frac{8000}{5^5} \rfloor

= 1600 + 320 + 64 + 12 + 2 = 1600 + 320 + 64 + 12 + 2

= 1998 =1998

This wiki from contest maths has got more details.

This looks better:

\textcolor{#FFFFFF}{-} 5 8000 5 1600 5 320 5 64 5 12 2 \begin{array}{|l} \llap{5~~~~} 8000 \\ \hline \llap{5~~~~} 1600 \\ \hline \llap{5~~~~} 320 \\ \hline \llap{5~~~~} 64 \\ \hline \llap{5~~~~} 12 \\ \hline 2 \end{array}

Shubhrajit Sadhukhan - 7 months, 3 weeks ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...