4. The record of a natural number x in a base-23 numeral system consists of $2 m$ identical digits. It turned out that in the 23-ary representation of the number $x^{2}$, the extreme digits are the same, and the other $4 m-2$ digits are zero. Find all such numbers x. Provide the answer in the 23-ary numeral system. (Digits from 10 to 22 are denoted by Latin letters from A to M.)
Answer: $x=D D_{23}$.

Solution. Let's agree to write $u \equiv v(\bmod w)$ if $(u-v) \vdots w$. Let $n=2 m$. According to the condition, for some 23-ary digits $a$ and $b$, the equality

$$
a^{2}\left(1+23+23^{2}+\ldots+23^{n-1}\right)^{2}=b\left(1+23^{2 n-1}\right)
$$

or, in another form,

$$
a^{2}\left(23^{n}-1\right)^{2}=22^{2} \cdot b\left(1+23^{2 n-1}\right)
$$

Since $23^{k} \equiv(-1)^{k}(\bmod 24)$, and $n$ is even, the left side (1) is divisible by $24^{2}$. Therefore, the right side (1) is also divisible by $24^{2}$. Note that

$$
1+23^{2 n-1} \equiv 1+(24-1)^{2 n-1} \equiv(2 n-1) \cdot 24\left(\bmod 24^{2}\right)
$$

Therefore, $b(2 n-1) \vdots 24$, from which $b \vdots 8$. Then $b=8$ or $b=16$. But

$$
1+23^{2 n-1} \equiv 1+7^{2 n-1}=1+7 \cdot 49^{n-1} \equiv 8(\bmod 16)
$$

Thus, the number $23^{2 n-1}+1$ is divisible by 8 and not divisible by 16, and therefore it is not a perfect square. This means that the case $b=16$ is impossible. Substituting $b=8$ into (2), we get

$$
a^{2}\left(1-2 \cdot 23^{n}+23^{2 n}\right)=22^{2} \cdot 8 \cdot\left(1+23^{2 n-1}\right) \Longleftrightarrow 23^{2 n-1}\left(23 a^{2}-22^{2} \cdot 8\right)=2 a^{2} \cdot 23^{n}-a^{2}+22^{2} \cdot 8
$$

Since the right side is positive, the inequality $23 a^{2}-22^{2} \cdot 8 \geqslant 1$ holds, from which

$$
23^{2 n-1} \leqslant 2 a^{2} \cdot 23^{n}-a^{2}+22^{2} \cdot 8<2 \cdot 22^{2} \cdot 23^{n}+22^{2} \cdot 8<3 \cdot 22^{2} \cdot 23^{n} \quad \text { and } \quad 23^{n-1}<3 \cdot 22^{2} .
$$

Of the even $n$, only $n=2$ satisfies this condition. Substitute it into (1):

$$
24^{2} \cdot a^{2}=8\left(1+23^{3}\right) \Longleftrightarrow a^{2}=169 \Longleftrightarrow a=13=D_{23}
$$

It remains to note that $D D_{23}^{2}=8008_{23}$.