Gábor noticed that the sum of $12^{3}+14^{3}$ has digits that are the reverse of the digits of $14^{3}$. Based on this, he gave the following problem to his mathematician friend, Feri. "Determine the four-digit (integer) number from which, when subtracting the number formed by writing its digits in reverse order, the difference is equal to the cube of an integer." - The next day, Feri said: There are more than 200 numbers that meet your conditions. - Gábor: Where is the 200 subtraction, since there is no calculation on your side? - F.: I managed to determine the number of such numbers without writing down even one of them. - G.: I don't believe in that calculation! - Was Feri right?
Feri's statement was correct. Let the consecutive digits of the sought four-digit number be $A, B, C, D$, where $A \neq 0$, but the other digits can be 0 as well. According to the requirement:

$$
\begin{gathered}
\left(A \cdot 10^{3}+B \cdot 10^{2}+C \cdot 10+D\right)-\left(D \cdot 10^{3}+C \cdot 10^{2}+B \cdot 10+A\right)= \\
999(A-D)+90(B-C)=n^{3}
\end{gathered}
$$

where $n$ is an integer, so it can be 0 and negative as well.

However, for now, it will suffice to focus on positive $n$ values. Indeed, if $n=0$, then $\overline{A B C D}=\overline{D C B A}$, the number is its own reverse, and 90 instances of the form $\overline{A B B A}$ provide uninteresting solutions (since the number of values $A$ and $B$ can take are 9 and 10, respectively). Furthermore, we know in advance that if $\overline{A B C D}$ is a solution, then $\overline{D C B A}$ is also a solution, provided $D>0$, in which case the difference is $-n^{3}$. The number of such solutions can easily be determined from the others by 2.

The left side is divisible by 9, so the right side must also be, which means $n$ is divisible by 3, $n=3 k$, where $k$ is an integer (since

$$
(3 k \pm 1)^{3}=27 k^{3} \pm 27 k^{2}+9 k \pm 1=9\left(3 k^{3} \pm 3 k^{2}+k\right) \pm 1
$$

does not yield a remainder of 0 when divided by 9). Substituting this into (1) and dividing by 27, we get

$$
37(A-D)+10 \cdot \frac{B-C}{3}=k^{3}
$$

Accordingly, the value of $B-C$ can only be $0, \pm 3, \pm 6$, and $\pm 9$, so the second term on the left side is $0, \pm 10, \pm 20$, or $\pm 30$. On the other hand, the value of $A-D$ is one of the numbers $0,1,2, \ldots, 9$, so the left side is not greater than $9 \cdot 37+30=373$. The positive cube numbers not exceeding this are:

$$
1, \quad 8, \quad 27, \quad 64, \quad 125, \quad 216, \quad 343
$$

and the multiples of 37 that are possible:

![](https://cdn.mathpix.com/cropped/2024_05_02_47aa707fd0ebfd18502fg-1.jpg?height=64&width=867&top_left_y=1185&top_left_x=618)

From here, it is easy to select those pairs of numbers whose difference is 0, 10, 20, or 30:

| I. | $37-27=10$, | then | $A-D=1$, | $C-B=3$, | $k=3, \quad n=9 ;$ |
| ---: | ---: | ---: | ---: | ---: | :--- |
| II. | $74-64=10$, | then | $A-D=2$, | $C-B=3 ;$ |  |
| III. | $333-343=-10$, | then | $A-D=9$, | $B-C=3$. |  |

In the case of the I. pair of numbers, $A$ can take the values $1,2, \ldots, 9$ to ensure $D \geqq 0$, similarly, $C$ can take the values $3,4, \ldots, 9$ to ensure $B \geqq 0$. The selection of these two digits is independent, so the number of solutions is $9 \cdot 7=63$. Similarly, from the II. pair of numbers, we get $8 \cdot 7=56$ solutions, and from the III. pair, we get $1 \cdot 7=7$ solutions, so for $n>0$, the number of solutions is $63+56+7=126$.

The solutions leading to negative $n$ values are obtained by multiplying both sides of (2) by -1. However, since $D$ cannot be 0, in each case of the I.-III. pairs of numbers, one fewer value fits $D$, so the number of solutions is

$$
8 \cdot 7+7 \cdot 7+0 \cdot 7=105
$$

Thus, the number of four-digit numbers from which, by subtracting their reverse, we get a non-zero integer cube, is 231; Feri was right.

The solution observed by Gábor comes from the II. pair of numbers.

Herényi István (Budapest, I. István g. III. o. t.)[^0]


[^0]:    ${ }^{1}$ Let's consider Feri serious, so he doesn't boast about meaningless solutions.

    ${ }^{2}$ But here we allow Feri to mention a larger number. Why didn't Gábor write a natural number! Besides, when writing a number, one doesn't immediately think about whether the number is greater than its reverse.