Waste less time on Facebook — follow Brilliant.

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
3 years, 6 months ago

No vote yet
1 vote


Sort by:

Top Newest

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 Siddhartha Srivastava · 3 years, 6 months ago

Log in to reply

@Siddhartha Srivastava Basically, do you mean the magnitude to which the power of 5 is raised? Samuel Squigi · 3 years, 6 months ago

Log in to reply

@Samuel Squigi Yes. Siddhartha Srivastava · 3 years, 6 months ago

Log in to reply

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}\) Bogdan Simeonov · 3 years, 6 months ago

Log in to reply


Problem Loading...

Note Loading...

Set Loading...