# Math Help - n! ends in exactly 124 zero

1. ## n! ends in exactly 124 zero

Find the smallest positive integer n such that n! ends in exactly 124 zero.

2. i guess n = 500, but not too sure. Can someone comfirm for me please? Thank you.

3. PS I posted before I saw your second posting.
Yes 500 is correct.

4. 500 is the answer, but "Why?" is a more interesting question. In order to count the zeroes at the end of a factorial, you want to count the 5's that occur, as every 5 is guaranteed to have a corresponding 2 that will multiply with it to form a 10 (adding a 0 to the end of your factorial), as there are more multiples of 2 than there are of 5. 5's should be counted more than once if (and only if) the number contains more than one 5 as a prime factor. For example, 5, 10, 15, and 20 can only count for only one 5, but numbers like 25 and 50 count for two 5's. Similarly, multiples of 125 count for three 5's.

Thus, in the first set of 100 numbers, we have sixteen 5's and four $5^2$'s.
In the second set, we have sixteen 5's, three $5^2$ and one $5^3$.
In the third set, we have sixteen 5's, three $5^2$, and one $5^3$.
In the fourth set, we have sixteen 5's, three $5^2$, and one $5^3$.
In the fifth set, we have sixteen 5's, three $5^2$, and one $5^3$.

Adding all these up, we have (16+16+16+16+16)*1+(4+3+3+3+3)*2+(1+1+1+1)*3 = 124 zeroes! Since we examined numbers up to 500, 500 is the smallest n such that n! contains 124 zeroes at the end of the number.