1. Find the smallest four-digit number $\overline{a b c d}$ such that the difference $(\overline{a b})^{2}-(\overline{c d})^{2}$ is a three-digit number written with three identical digits.
SOLUTION. Let us first look for a solution to the equation for the smallest three-digit number with the same digits, which we will immediately factorize into prime factors:

$$
\overline{a b}^{2}-\overline{c d}^{2}=(\overline{a b}+\overline{c d})(\overline{a b}-\overline{c d})=111=37 \cdot 3
$$

The first parenthesis is positive, and the product of both parentheses is a positive number, so both parentheses are positive. The number $\overline{a b c d}$ is a four-digit number, so $a \geqq 1$, which means $\overline{a b} \geqq 10$, and thus $\overline{a b}+\overline{c d} \geqq 10$. Since 37 and 3 are prime numbers, we have only two possibilities in the factorization of the equation (1): either $\overline{a b}+\overline{c d}=37$ and $\overline{a b}-\overline{c d}=3$, or $\overline{a b}+\overline{c d}=111$ and $\overline{a b}-\overline{c d}=1$.

In the first case, solving the system $\overline{a b}+\overline{c d}=37, \overline{a b}-\overline{c d}=3$ gives us the values $\overline{a b}=20$ and $\overline{c d}=17$, so $\overline{a b c d}=2017$. In the second case, we similarly get $\overline{a b c d}=5655$.

Now we will show that no number less than 2017 has the required property. Suppose that such a number $\overline{a b c d}<2017$ exists. In that case, $\overline{a b} \leqq 20$, and thus $\overline{a b}^{2}-\overline{c d}^{2} \leqq 20^{2}=400<444$, so the difference $\overline{a b}^{2}-\overline{c d}^{2}$ is equal to one of the numbers 111, 222, or 333. The first possibility has already been fully resolved by solving equation (1), let's consider the remaining two possibilities.

The equation

$$
(\overline{a b}+\overline{c d})(\overline{a b}-\overline{c d})=222=2 \cdot 3 \cdot 37
$$

leads (considering $\mathrm{k} \overline{a b} \geqq 10)$ to the possibilities ${ }^{1}(\overline{a b}+\overline{c d}, \overline{a b}-\overline{c d}) \in\{(37,6),(74,3),(111,2),(222,1)\}$. Solving the four corresponding systems of two unknowns, we get

$$
(\overline{a b}, \overline{c d}) \in\left\{\left(\frac{43}{2}, \frac{31}{2}\right),\left(\frac{77}{2}, \frac{71}{2}\right),\left(\frac{113}{2}, \frac{109}{2}\right),\left(\frac{223}{2}, \frac{221}{2}\right)\right\}
$$

which does not yield any integer solutions.

Finally, the equation

$$
(\overline{a b}+\overline{c d})(\overline{a b}-\overline{c d})=333=3 \cdot 3 \cdot 37
$$

leads to the possibilities $(\overline{a b}+\overline{c d}, \overline{a b}-\overline{c d}) \in\{(37,9),(111,3),(333,1)\}$. Solving the three corresponding systems, we get

$$
(\overline{a b}, \overline{c d}) \in\{(23,14),(57,54),(167,166)\}
$$

in none of which $\overline{a b} \leqq 20$.

Answer. The solution to the problem is the number 2017. [^0]