# N! ends with exactly 30 zeros? [duplicate]

How many values of N exist, such that N! ends with exactly 30 zeros?

-

## marked as duplicate by draks ..., Jyrki Lahtonen♦, Gina, amWhy, WilliamJul 18 '14 at 11:42

Do you know how to compute the number of zero's at the end of $n!$? – Ragnar Jul 18 '14 at 10:43
@draks...: nice string of duplicates. – robjohn Jul 18 '14 at 11:09
@barak What if $(M+1)$ was a multiple of 100...? – CiaPan Jul 18 '14 at 11:44

The number of zeros at the and of $n!$ is just the number of factors of $5$ in $n!$ (since the number of factors of $2$ in $n!$ is always larger than that). So, we need all $n$ such that the number $1$ up to $n$ have a total of $30$ factor of $5$. A first guess would be $30\cdot 5=150$, but then we forget that the multiples of $5^2=25$ have (at least) two factors of $5$. Since there are $5$ multiples of $25$ below $150$, we should try $n=125$. The numbers below $125$ have a total of $$\frac{120}{5}+\left\lfloor\frac{120}{25}\right\rfloor=24+4=28<30$$ factors of $5$. If we include $125=5^3$, the number of factors increases with $3$ so it becomes $31>30$. Thus, we find that the are no $n$ such that $n!$ has $30$ factors of $5$ or s.t. $n!$ ends with $30$ zeros.
As explained in this answer, for a prime $p$, the number of factors of $p$ in $n!$ is $$\frac{n-\sigma_p(n)}{p-1}$$ So as an estimate, we can use $n/4$ for the number of factors of $5$ that divide $n!$. For $30$ zeros, we would try $n=120$ ($440_\text{five}$). $$\frac{120-8}{5-1}=28$$ Since no factors of $5$ are added until $n=125$ ($1000_\text{five}$), and that adds $3$, we have $31$ factors of $5$: $$\frac{125-1}{5-1}=31$$ Thus, there are no integer values of $n$ so that $n!$ ends in $30$ zeros (in decimal).