Task A-2.6. (10 points)

Determine all natural numbers less than 1000 that are equal to the sum of the squares of their digits.
## Solution.

Let the desired number be $n=\overline{a b c}$. (We will allow leading digits to be 0).

We want $a^{2}+b^{2}+c^{2}=100 a+10 b+c$.

Since $a, b$, and $c$ are digits, $a^{2}+b^{2}+c^{2} \leqslant 3 \cdot 9^{2}=243$, so $a \leqslant 2$.

2 points

Furthermore, we conclude that $a^{2}+b^{2}+c^{2} \leqslant 2^{2}+9^{2}+9^{2}=166$, so $a \leqslant 1$.

2 points

1. Case. Let $a=1$. Then $b^{2}+c^{2}=99+10 b+c$.

However, $b^{2} \leqslant 10 b$ and $c^{2} \leqslant 81<99+c$, so the left side is strictly less than the right side, and equality cannot be satisfied.

2. Case. Let $a=0$. Then $b^{2}+c^{2}=10 b+c$,

which we can write in the form $b(10-b)=c(c-1)$.

The expression $b(10-b)$ can be $0 \cdot 10=0,1 \cdot 9=9,2 \cdot 8=16,3 \cdot 7=21,4 \cdot 6=24$, and $5 \cdot 5=25$, while the expression $c(c-1)$ can be $0,2,6,12,20,30,42,56$ or 72.

Therefore, it must be that $b(10-b)=c(c-1)=0$, i.e., $b=0$ and $c \in\{0,1\}$.

The only natural number less than 1000 with the given property is the number 1.