TITLE: how many zeroes does 2012! have at the end?
QUESTION [5 upvotes]: Possible Duplicate:
How come the number $N!$ can terminate in exactly $1,2,3,4,$ or $6$ zeroes but never $5$ zeroes? 


How many zeroes does $2012!$ end with? 

My idea is: 
402 zeroes come from $2\times 5$, 80 from $2\times 25$, 16 from $2\times 125$ and 3 from $2\times 625$ 
How can we "show" that this is true?

REPLY [14 votes]: The correct answer is 501.
In order to find the number of zeros is same as finding the number of factors of powers of $5$. There are more factors of powers of $2$ than the factors of powers of $5$.
For instance $10! = 3628800 = \hspace{3pt}2^8 \hspace{3pt} 3^4 \hspace{3pt}5^2\hspace{3pt} 7$
$$\left \lfloor \frac{n}{p}  \right \rfloor +\left \lfloor \frac{n}{p^2}   \right \rfloor +\left \lfloor \frac{n}{p^3}\right  \rfloor  + \cdots \left \lfloor \frac{n}{p^{k-1}}  \right \rfloor$$
where $\left \lfloor \frac{n}{p^k} \right \rfloor=0$. 
In this case $k=5$ because $\left \lfloor \frac{2012}{5^5} \right \rfloor=0$
$$\left \lfloor \frac{2012}{5}  \right \rfloor =402, \hspace{6pt} \left \lfloor \frac{2012}{5^2}  \right \rfloor = \left \lfloor \frac{402}{5}  \right \rfloor =80$$
$$\left \lfloor \frac{2012}{5^3} \right \rfloor = \left \lfloor \frac{80}{5}  \right \rfloor =16, \hspace{6pt} \left \lfloor \frac{2012}{5^4} \right \rfloor = \left \lfloor \frac{16}{5}  \right \rfloor =3$$
$$\left \lfloor \frac{2012}{5}  \right \rfloor+ \left \lfloor \frac{2012}{5^2}\right \rfloor +\left \lfloor \frac{2012}{5^3}\right \rfloor +\left \lfloor \frac{2012}{5^4} \right \rfloor = 402+80+16+3=501$$