[Math] with how many zeros it ends

elementary-number-theory

I have to calculate with how many zeros 1000! ends. This is wat I did, but I am not sure whether its good: I think I have to calculate how many times the product 10 is in 1000!. I found out the factor 10 is 249 times in 1000! using the fact that $s_p(n!)=\sum_{r=1}^{\infty}\lfloor \frac{n}{p^r}\rfloor$. So I think the answer should be that it ends with 249 zeros.

Is this correct/are there other ways to do this? If not how should I do it then?

Best Answer

First, let's note that $10$ can be factored into $2 \times 5$ so the key is to compute the minimum of the number of $5$'s and $2$'s that appear in $1000!$ as factors of the numbers involved. As an example, consider $5! = 120$, which has one $0$ because there is a single $5$ factor and a trio of $2$ factors in the product, one from $2$ and a pair from $4$.

Thus, the key is to compute the number of $5$'s, $25$'s, $125$'s, and $625$'s in that product as each is contributing a different number of $5$'s to the overall product as these are the powers of $5$ for you to consider as the $2$'s will be much higher and thus not worth computing.

So, while there are 200 times that $5$ will be a factor, there are 40 times for $25$ being a factor, eight for $125$ and one for $625$, which does give the same result as you had of 249, though this is a better explanation.

Related Question