## Task B-4.6.

Determine all four-digit natural numbers that are 1949 greater than the sum of the squares of their digits.
## Solution.

Let the desired number be $x=\overline{a b c d}=1000 a+100 b+10 c+d$ where $a, b, c$, and $d$ are digits, that is, $a, b, c, d \in\{0,1,2, \ldots, 9\}$ and $a \neq 0$. Then we have

$$
1000 a+100 b+10 c+d=a^{2}+b^{2}+c^{2}+d^{2}+1949
$$

The sum of squares $a^{2}+b^{2}+c^{2}+d^{2}$ can be at most $4 \cdot 81=324$. Therefore, $x \leqslant 324+1949=$ 2273, so the digit $a$ can only be 1 or 2.

If $a=1$, then from $1000 a+100 b+10 c+d=a^{2}+b^{2}+c^{2}+d^{2}+1949$ it follows that

$$
100 b+10 c+d=b^{2}+c^{2}+d^{2}+950
$$

Since the right-hand side is greater than 950, this equality is not possible for $b<9$.

However, in the case $b=9$, there are no digits $c$ and $d$ for which the equality $10 c+d=$ $131+c^{2}+d^{2}$ holds (since the left-hand side is a two-digit number, while the right-hand side is a three-digit number).

Therefore, it must be that $a=2$.

Then $2000+100 b+10 c+d=1949+4+b^{2}+c^{2}+d^{2}$, or equivalently,

$$
100 b+10 c+d+47=b^{2}+c^{2}+d^{2}
$$

Since $b^{2}+c^{2}+d^{2} \leqslant 3 \cdot 81=243$, the previous equality is only possible for $b \in\{0,1,2\}$.

$1^{\circ} b=2$

From $\left({ }^{*}\right)$ it follows that $200+10 c+d+47=4+c^{2}+d^{2}$, or $10 c+d+243=c^{2}+d^{2}$.

Since $c^{2}+d^{2} \leqslant 2 \cdot 81=162$, the left-hand side is greater than 243, while the right-hand side is less than 162, which is impossible, so $b \neq 2$.

$2^{\circ} b=1$

From $\left({ }^{*}\right)$ it follows that $100+10 c+d+47=1+c^{2}+d^{2}$, or $10 c+d=c^{2}+d^{2}-146$.

The left-hand side is a two-digit number, so $c^{2}+d^{2} \geqslant 146$, which is only possible if $c=d=9$. Direct verification shows that the previous equality does not hold in this case either, so $b \neq 1$.
$3^{\circ} b=0$

From $(*)$ it follows that

$$
10 c+d+47=c^{2}+d^{2}
$$

We can substitute $c=0, c=1, \ldots, c=9$ into this equation, or observe that $c$ must be an odd number and substitute only odd digits.

For easier verification, the equation $(**)$ can be written in the form

$$
d(d-1)=47+10 c-c^{2}=72-(c-5)^{2}
$$

Now we seek all numbers $c$ for which the number on the right-hand side is equal to the product of two consecutive digits.

$$
\begin{aligned}
& c=1, d(d-1)=56=8 \cdot 7 \\
& c=3, d(d-1)=68 \\
& c=5, d(d-1)=72=9 \cdot 8 \\
& c=7, d(d-1)=68 \\
& c=9, d(d-1)=56=8 \cdot 7
\end{aligned}
$$

Thus, the solutions to the problem are the numbers 2018, 2059, and 2098.

Note: If a student has guessed 1 or 2 solutions by listing some cases, they receive 1 point.

Note: For guessing all three solutions by listing some cases, without justification that these are the only solutions, the student receives 2 points.

Note: If a student concluded that the desired number starts with the digit 2 and listed all such numbers, and arrived at the correct solution through verification, give all points.

Note: Otherwise, the scoring is as follows:

- writing $1000 a+100 b+10 c+d=a^{2}+b^{2}+c^{2}+d^{2}+1949$

1 point

- conclusion $a \in\{1,2\}$

1 point

- verification for $a=1$ and conclusion that $a=2$

2 points

- conclusion that $b=0$, either by verifying all 10 digits or by eliminating some possibilities

(division into cases 1 point, elimination of cases and justification 2 points)

-determining the digits $c, d$, and the final solution (writing + verification or as in the provided solution, restriction + verification of some cases)