A number theory problem by Nikhil Raj

How many trailing zeroes are there in 5000 ! 5000! ?


The answer is 1249.

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.

1 solution

Zach Abueg
May 28, 2017

Relevant wiki: Trailing Number of Zeros

The formula for finding the number of trailing zeros in n ! n! is:

f ( n ) = i = 1 k n 5 i = n 5 + n 5 2 + n 5 3 + + n 5 k , \begin{aligned} f(n) &= \sum_{i \ = \ 1}^k \left\lfloor{\frac{n}{5^i}}\right\rfloor = \left\lfloor{\frac{n}{5}}\right\rfloor+\left\lfloor{\frac{n}{5^2}}\right\rfloor+\left\lfloor{\frac{n}{5^3}}\right\rfloor+\dots+\left\lfloor{\frac{n}{5^k}}\right\rfloor, \end{aligned}

where k = log 5 n . k = \left\lfloor \log_5 n \right\rfloor .

For n = 5000 \displaystyle n = 5000 , k = 5 \displaystyle k = 5 :

f ( 5000 ) = i = 1 5 5000 5 n = 5000 5 1 + 5000 5 2 + 5000 5 3 + 5000 5 4 + 5000 5 5 = 1000 + 200 + 40 + 8 + 1 = 1249 \begin{aligned} f(5000) & = \sum_{i \ = \ 1}^5 \left\lfloor{\frac{5000}{5^n}}\right\rfloor \\ \\ & = \left\lfloor{\frac{5000}{5^1}}\right\rfloor+\left\lfloor{\frac{5000}{5^2}}\right\rfloor+\left\lfloor{\frac{5000}{5^3}}\right\rfloor+\left\lfloor{\frac{5000}{5^4}}\right\rfloor+\left\lfloor{\frac{5000}{5^5}}\right\rfloor \\ \\ & = 1000 + 200 + 40 + 8 + 1 \\ & = 1249 \end{aligned}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...