# How much zeros has the number $1000!$ at the end?

I know that it depends of the factors of five and two.

But the number is too long to figure how much factos of five and two there are.

Any hints?

• – lhf May 13 '14 at 13:56
• – Indrayudh Roy May 13 '14 at 13:56

There are always twos a-plenty. The exponent of prime $p$ occuring in $n!$ is well-known to be $$\lfloor n/p\rfloor +\lfloor n/p^2\rfloor + \lfloor n/p^3\rfloor +\ldots$$ hence for $n=1000$ and $p=5$ we find $$\lfloor 1000/5\rfloor +\lfloor 1000/25\rfloor + \lfloor 1000/125\rfloor +\lfloor 1000/625\rfloor + \ldots= 200+40+8+1+0+\ldots=249$$ (Just to check, for $p=2$ we get $$500+250+125+62+31+15+7+3+1\gg249$$ so really more than enough)

yes it depends on $2$ and $5$. Note that there are plenty of even numbers. Also note that $25\times 4 = 100$ which gives two zeros. Also note that there $125\times 8 = 1000$ gives three zeroes and $5^4 \times 2^4 = 10^4$. Each power of $5$ add one extra zero. So, count the multiple of $5$ and it's power less than $1000$.

the number of factor 2's between 1-1000 is more than 5's.so u must count the number of 5's that exist between 1-1000.can u continue?

If a number ends with $n$ zeros than it is divisible by $10^n$, that is $2^n5^n$.
A factorial clearly has more $2$s than $5$s in its factorization so you only need to count how many $5$s are there in the factorization of $1000!$
There are $\lfloor\frac{1000}{5}\rfloor=200$ numbers below $1000$ that can be divided by $5$, but you also have to consider that there are $\lfloor\frac{1000}{5^2}\rfloor=40$ numbers divisible by $25$, $\lfloor\frac{1000}{5^3}\rfloor=8$ and $\lfloor\frac{1000}{5^4}\rfloor=1$ number divisible by $625$, for a total of $249$ zeros.

Two questions:

Can you work out which of $2$ and $5$ will be the critical one for your question? A little thought should make this obvious.

You say that "the number is too long" - but actually the number of factors can be computed quite quickly even by hand. Can you see how many factors $521$ there might be, or factors $257$ in the product? How about factors $31$? Can you apply this to your choice of $2$ or $5$?

• This seemed to me to be a hint in response to a homework question which asked for a hint. – Mark Bennet May 13 '14 at 15:15