0
$\begingroup$

I'm trying to figure out the pattern:

There is 10 , 20, 30 whose product gives three 0s (6000)

Then there are the following that would result in 10: 2 x 5 = 10 4 x 15 = 60 6 x 25 = 150

So, initially I thought there are 6 zeros by merely counting the zeros. But the product (6000 * 10 * 60 * 150) was giving me 7 zeros. I realized it is because 60 * 150 gives me another zero (9000)

Rewriting/rearranging seems to make this clear: 2 x 5 = 10 6 x 15 = 90 4 x 25 = 100

So, even though I got 7 0s, I was wondering if there is a pattern in these question or if is trial-error method only. Is there an efficient way to answer this question.

I have the explanation in the book and it seems to be a bit convoluted. I can type in the explanation if someone wants to take a look.

Thanks, grajee

Question: How many identical digits end the product? 1 x 2 x 3 x 4 x 5 x 6 x 7 x .... x 30

Answer: 7

$\endgroup$
1
$\begingroup$

The most general answer: you should count the number of factors $2$ and $5$ in the product, and the minimum of these two numbers gives you the number of factors $10$. In most cases, it boils down to counting the number of factors $5$ you find in the product.

In your example the answer is $7$ because of the factors $5$ in $5, 10, 15, 20, 25, 25, 30$. Note that $25$ contains two factors $5$.

$\endgroup$
0
$\begingroup$

Given positive integers $n_1, \ldots, n_k$, let $a_i$ be the exponent of $2$ in the prime factorization of $n_i$, and $b_i$ be the exponent of $5$ in $n_i$. Then we have the number of zeroes at the end of $n_1 \ldots n_k$ is equal to $\min\{ a_1 + \ldots + a_k, b_1 + \ldots + b_k\}$.

For $1 \cdot 2 \cdot \ldots \cdot 30$ we have 15 terms divisible by $2$, 7 terms divisible by $4$, 3 terms divisible by $8$, and 1 term divisible by $16$. So $a_1 + \ldots + a_{30} = 26$.

We have 6 terms divisible by $5$, and 1 term divisible by $25$, so $b_1 + \ldots + b_{30} = 7$.

The minimum of these is $7$.

In general when looking at the number of zeroes at the ends of $n!$, we can argue its going to be $\sum_{i=1}^{\log_5(n)} \lfloor \frac{n}{5^i} \rfloor$

$\endgroup$
0
$\begingroup$

Note that a $0$ is pretty much just a $5$ and a $2$. In a product like this, it is rather easy to see that we'll have more $2$s than $5$s, so the number of $0$s at the end is just the number of $5$s in the prime factorization.

In general, the number of factors $p$ in $n!$, with $p$ prime, is

$$\sum_{k=1}^{\infty} \left \lfloor\frac{n}{p^k}\right \rfloor $$

(Note that if $p^k>n$, these terms are $0$, so the sum is actually finite). It's a good exercise to prove this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.