1

Find the maximum number of zeros at the end of $376!$.

To do this, I divided $376$ by powers of $5$ and then "took" their floor function and then added them up:

$$\lfloor \frac{376}{5} \rfloor + \lfloor \frac{376}{25} \rfloor + \lfloor \frac{376}{125} \rfloor = 75 + 15 + 3 = 93$$

Now $93$ was the right answer, but apparently I had to look at powers of $2$ as well but ignore them for some reason. Why do I have to do this?

Kaish
  • 6,126

3 Answers3

1

We ignore number of powers of $2$, because there are plenty of them. The scarce one is $5$s. Because of this we only count the powers of $5$s.

hkBattousai
  • 4,543
0

You need factors of $2$ as well as $5$ to make a zero, but the same approach as you used shows there are plenty of them around. In fact there will be almost 376 of them.

Ross Millikan
  • 374,822
0

To be more precise, the number of $2$s in $n!$ is $$\begin{matrix}&\lfloor\frac{n}2\rfloor&+\lfloor\frac{n}4\rfloor&+\lfloor\frac{n}8\rfloor&+\lfloor\frac{n}{16}\rfloor&+\ldots\; \\ \ge&\lfloor\frac{n}5\rfloor&+\lfloor\frac{n}{25}\rfloor&+\lfloor\frac{376}{125}\rfloor&+\lfloor\frac{376}{625}\rfloor&+\ldots, \end{matrix}$$ i.e. in general we have $\lfloor \frac n{2^k}\rfloor\ge\lfloor \frac n{5^k}\rfloor$, which makes $5$s the rare thing.