# How many zeros...

Hi all,

Is there a general way to find out how many zeros there are at the end of some product like $$50!$$ or $$2^{12} \times 5^{10} \times 3^{27}$$?

I know the examples I gave are easy. But for harder problems like the number of zeros at the end of $$2014!$$, is there a proper way?

Help would be appreciated. After all, I'm still 13 :P

Note by Victor Loh
4 years, 4 months ago

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$...$$ or $...$ to ensure proper formatting.
2 \times 3 $$2 \times 3$$
2^{34} $$2^{34}$$
a_{i-1} $$a_{i-1}$$
\frac{2}{3} $$\frac{2}{3}$$
\sqrt{2} $$\sqrt{2}$$
\sum_{i=1}^3 $$\sum_{i=1}^3$$
\sin \theta $$\sin \theta$$
\boxed{123} $$\boxed{123}$$

Sort by:

To find the number of zeros at the end of a product, we need to find the minimum of the exponent of 5 and 2, since a number $$abcdef0000$$ is equal to $$abcdef \times 10000 = abcdef \times 10^4 = abcdef = \times 2^4 \times 5^4$$. Note $$abcdef$$ can contain a factor of 2 or 5 but not both, or else it would end in 0. So the number of zeros in a number is the minimum of the exponents of 5 and 2.

So in $$2^{12} \times 5^{10} \times 3^{27}$$ the number of trailing zeroes is $$min(12,10) = 10$$.

In products like $$n!$$, it is easy to see that the exponent of 5 will be less than the exponent of 2.So we just need to find the exponent of 5. To find the exponent of 5 in $$n!$$, you can use Legendre's formula

- 4 years, 4 months ago

Basically, do you mean the magnitude to which the power of 5 is raised?

- 4 years, 4 months ago

Yes.

- 4 years, 4 months ago

For factorials, the general formula for how many zeros there are is practically asking what is the highest power of 5 which divides n!(because the largest power of 2 that divides n! is bigger).The formula is

$$\displaystyle\sum_{i=1}^{\infty}\left \lfloor \frac{n}{5^i}\right \rfloor$$. At some point, the $$5^i$$ 's will get bigger than n, so the sum is finite.

The reason that the formula works is that you are doing this: first you count the numbers less than or equal to n that are divisible by 5.But then you would have missed the extra powers from the ones that are divisible by 25 etc.

The formula works for any prime p, not just for 5. It is an easy way to figure out the prime factorization of n! without actually calculating it.

For instance, the highest power of 10 that divides 50! is

$$10+2+0+0...=\boxed{12}$$

- 4 years, 4 months ago

×