# How many zeros are at the end?

My answer to the following problem is 1337 (from the first one) +2 (from the second one) + 4646 (from the last one) = 5985. But it is different from what in answer sheet. I wonder whether I get the concept wrong. It is highly appreciated if anyone can give me a help.

How many zeros are at the end of $420^{1337}$ x $900!$ x $20160^{4646}$ ?

• You need to consider how many times pairs of factors $\ 2 \$ and $\ 5 \$ occur in each factor in your product. For instance, $\ 900! \$ is going to have rather more than two zeroes to the left of the decimal point... – colormegone May 17 '16 at 16:22
• $900!$ has far more than 2. Think of all the multiples of 2, 5 and 10 that are less than 900. – almagest May 17 '16 at 16:22
• Thanks. Is there an easy way to find out how many zeros in 900!? – user321527 May 17 '16 at 16:25
• How many zeros in 900!? For every multiple of 5, 25, 125, 625 there will be many other multiples of 2, 4, 8, and 16 to allow these to combine to 10, 100,1000, 10000. So we need to count mutiples of 5, there are 180 multiples of 5. These account for 180 zeros. There and 36 multiples of 25. Excluding the zeros we already counted these will account for 36 new zeros. There are 7 multiples of 125 so there are 7 more 0. And 625 will account for 1 more. So 900! ends with 180 + 36 + 7 + 1 = 224 zerros. – fleablood May 17 '16 at 17:04

As you said the $420^{1337}$ contributes 1337 zeros and the $20160^{4646}$ contributes 4646 zeros so lets focus on the $900!$.

In $900!$ we need to consider how many 2's and 5's there will be. Clearly there will be more 2's than 5's so the limiting factor for creating zeros at the end will be 5's.

In $900!$ there will be $\frac{900}{5}=180$ numbers which divide by 5. However $\frac{900}{25}=36$ of those will divide by 5 a second time. Also $\lfloor\frac{900}{125}\rfloor=7$ of those will divide by 5 a third time and $\lfloor\frac{900}{625}\rfloor=1$ of those will divide by 5 a fourth time. So there will be $180+36+7+1=224$ 5's in $900!$. Hence $900!$ will contribute 224 zeros.

So the total number of zeros is: $1337+4646+224=6207$.

• You were lucky, because your approach is a little flawed: there could have been unpaired factors $2$ and $5$ in the three numbers, not contributing a zero in them individually, but forming one when multiplied together. Like $20^2\cdot500^2$ has more than $6$ zeroes. – Yves Daoust May 17 '16 at 16:56
• Besides 2s and 5s, there are 0s such as 800, 700...., should they be considered too? – user321527 May 18 '16 at 15:54

Hint:

Let $P(N!)$ - the number of zeros at the end of $N!$. Then $$P(N!)=\left[\frac N5\right]+\left[\frac N{5^2}\right]+\left[\frac N{5^3}\right]+...+\left[\frac N{5^n}\right]+...$$

• I guess there must be a lower bound – openspace May 17 '16 at 16:41
• If $5^n>N$ then $\left[\frac N{5^n}\right]=0$ – Roman83 May 17 '16 at 16:44
• yes, but I want to talk that about : $\frac{900}{125} = 7$ , not $8$. So there is a sum of lower bounds – openspace May 17 '16 at 16:46
• @openspace: what do you mean by "there is a sum of lower bounds" ?? – Yves Daoust May 17 '16 at 17:12

The factors $2$ and $5$ in the powers are as below$$420\to2^2\cdot5,\\20160\to2^6\cdot5,$$

so $2\cdot1337+6\cdot4646$ times $2$ and $1337+4646$ times $5$.

The factorial gives

$$\frac{900}2+\frac{450}2+\frac{225}2+\frac{112}2+\frac{56}2+\frac{28}2+\frac{14}2+\frac{7}2+\frac{3}2=895$$ times $2$ and $$\frac{900}5+\frac{180}5+\frac{36}5+\frac75=224$$ times $5$.

In total, $$2^{31445}\cdot5^{6207}$$ which yields $6207$ zeroes.

Actually it wasn't necessary to count the multiplicty of $2$ as it clearly dominates.