4. A positive integer $a$ consists of four digits, three of which are the same. The square of $a$ consists of seven digits, all of which are different. Number $b$ is obtained by reading number $a$ from back to front. It turns out that number $b$ is greater than $a$. In addition, it turns out that $b^{2}$ is exactly equal to $a^{2}$ read from back to front.

Find all possibilities for $a$.
B4. 1113 Since both $a^{2}$ and $b^{2}$ have only seven digits, the digits of $a$ and $b$ cannot be too large. Indeed, $4000^{2}=16,000,000$, so the first digit of both $a$ and $b$ is 1, 2, or 3. Since you get $b$ by reading $a$ backwards, the last digit of both $a$ and $b$ is also 1, 2, or 3. If the first and last digits of $a$ are the same, then the first and last digits of $b$ are also the same and equal to the first and last digits of $a$. But then the last digit of $a^{2}$ is equal to the last digit of $b^{2}$, and that cannot be, since $a^{2}$ and $b^{2}$ each have seven different digits, in reverse order. Therefore, the first and last digits of $a$ are not the same. This means that both $a$ and $b$ can only contain the digits 1, 2, and 3. The remaining possibilities for $a$ are now 1112, 1113, 1222, 1333, 2223, and 2333. The last three possibilities can be immediately ruled out because the square of $b$ would then be at least $3200^{2}$, which already has eight digits. Testing the first three possibilities gives $a=1113$ as the only possibility. In that case, $a^{2}=1,238,769$, $b=3111$, and $b^{2}=9,678,321$.