
1. A four-digit natural number is given which is divisible by seven. If we write its digits in the reverse order, we obtain another four-digit natural number, which is greater and is also divisible by seven. Furthermore, both numbers give the same remainder upon division by 37. Determine the original four-digit number.


Solution. Denote the given number by $n=\overline{a b c d}=1000 a+100 b+10 c+d$, and the one obtained by reversing the order of digits $k=\overline{d c b a}=1000 d+100 c+10 b+a$. Since both numbers $k, n$ give the same remainder upon dividing by 37 , their difference

$$
\begin{aligned}
k-n & =(1000 d+100 c+10 b+a)-(1000 a+100 b+10 c+d)= \\
& =999(d-a)+90(c-b)=37 \cdot 27(d-a)+90(c-b)
\end{aligned}
$$

must be divisible by 37 , whence $37 \mid 90(c-b)$. As 37 is a prime and 90 is not its multiple, necessarily $37 \mid c-b$. For two digits $b, c$, this is only possible if $b=c$. Conversely, if $b=c$, then it follows from (1) that the difference $k-n$ is divisible by 37, regardless of the values of $a$ and $d$, so the two numbers $k$ and $n$ give the same remainder upon division by 37 . From now on, we can therefore assume that $n=\overline{a b b d}$ and $k=\overline{d b b a}$, and will be concerned only with the conditions of the divisibility by seven.

From the conditions $7|n, 7| k$ we have

$$
7 \mid k-n=37 \cdot 27(d-a)
$$

(we have substituted the equality $b=c$ into (1)). Since the numbers 7 and $37 \cdot 27$ are relatively prime, we must have $7 \mid d-a$. Since we know that $k>n$, necessarily $d>a$; and as $a, d$ are digits, this is only possible if $d-a=7$. Finally, as $a$ is the first digit of the four-digit number $n$, we must have $a>0$; thus the only possibilities are $a=1, d=8$ or $a=2, d=9$.

For $a=1$ and $d=8$, the numbers

$$
\begin{aligned}
& n=\overline{1 b b 8}=1008+110 b=7 \cdot(144+15 b)+5 b, \\
& k=\overline{8 b b 1}=8001+110 b=7 \cdot(1143+15 b)+5 b,
\end{aligned}
$$

are divisible by seven if and only if $7 \mid 5 b$, or $b \in\{0,7\}$. We thus get the first two solutions $n=1008$ and $n=1778$.

Similarly, for $a=2$ and $d=9$,

$$
\begin{aligned}
& n=\overline{2 b b 9}=2009+110 b=7 \cdot(287+15 b)+5 b, \\
& k=\overline{9 b b 2}=9002+110 b=7 \cdot(1286+15 b)+5 b
\end{aligned}
$$

are divisible by seven iff $7 \mid 5 b$, which leads to the two remaining solutions $n=2009$ and $n=2779$.

The original four-digit number can be any of the numbers 1008, 1778, 2009 and 2779 (and no other).
