Find the smallest positive integer n such that n! ends in exactly 124 zero.
Please help. Thank you in advance.
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 's.
In the second set, we have sixteen 5's, three and one .
In the third set, we have sixteen 5's, three , and one .
In the fourth set, we have sixteen 5's, three , and one .
In the fifth set, we have sixteen 5's, three , and one .
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.