Largest prime factor of sum

496 Views Asked by At

Given a positive integer $n$, let $P(n)$ be the product of the non-zero digits of $n$ (if $n$ is a one digit number, $P(n)$ is $n$ itself). Let $S=P(1)+P(2)+P(3)+\ldots+P(999)$. Then, what is the largest prime factor of $S$?

I could not find the way how to start this problem. Please help me out.

3

There are 3 best solutions below

2
On

A big hint

Let the sum of your numbers $P(i)$ for $1\le i \le 99$ be $T$.

Then the sum of the $P(i)$ for $101\le i \le 199$ is also $T$.

The sum of the $P(i)$ for $201\le i \le 299$ is $2T$.

...

The sum of the $P(i)$ for $901\le i \le 999$ is $9T$.

The sum of the numbers I've listed is therefore $(1+1+2+...+9)T=46T$.

Find a similar trick to find $T$ easily and you'll soon find the answer. Remember to add in $P(100)$ etc

2
On

Hint: Show that:

$ S = (1+1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 )^3 - 1$

When you expand the expression, which term corresponds to the product of the digits in 000, 001, 123, 302, 999?

0
On

Define the function $$f(n)=\begin{cases} 1 & (n= 0) \\ n & (n\geq1) \end{cases} $$ Note that for a number of at most three digits $\overline{abc}$, $$P\left(\overline{abc}\right)=f\left(a\right)f\left(b\right)f\left(c\right).$$ Therefore, $$\sum_{n=1}^{999}P(n)=\left(\sum_{a=0}^9 \sum_{b=0}^9 \sum_{c=0}^9 f\left(a\right)f\left(b\right)f\left(c\right)\right)-f\left(0\right) f\left(0\right) f\left(0\right) =\left(\sum_{a=0}^9 f\left(a\right)\right)^3-1=46^3-1=97335.$$ This last number can be easily factorized as $3^3\times5\times7\times103$, so that $\boxed{103}$ is its greatest prime factor.