A problem involving sum of digits function and sum of square of digits

93 Views Asked by At

I am trying to solve the following problem which appeared in the Mayo Olympiad in 2016.

Let $s(n)$ be the sum of digits of $n$ and let $s_2(n)$ be the sum of square of digits of $n$

Problem. Give an example of a positive integer $n$ without the digit $0$ in its decimal expansion, such that $n\equiv 0\pmod{s_2(n)}$ and $s(n)=1001$.

I was no able to solve it after many attempts. Any suggestion?

1

There are 1 best solutions below

2
On BEST ANSWER

Everything starts with a guess.

Assume the desired number $A$ is a $502$-digit number including $499$ $2$'s and three $1$'s such that the first, third and $174$th digits (from right) are $1$;

$$A= 22 ... 2 1 2 .. 2121.$$

Then $s_2(A)=1999$ (which is a prime number) and $s(A)=1001$.

On the other hand:

$$A=2(\frac{10^{502}-1}{9})-10^{173}-10^2-1.$$

You can check that $A \equiv 0 (mod \ 1999)$ (I checked this with Wolfram).