# Problem 8. (5 points)

For each pair of numbers $\overline{a b b}$ and $\overline{a b a}$, where $a$ and $b$ are different digits, the GCD of these numbers was calculated. Find the greatest of these GCDs.

$\overline{a a b}$ - standard notation for a number consisting of digits $a, a$ and $b$ in exactly that order.

Answer: 18
Solution:

18 is the greatest common divisor (GCD) of the numbers 828 and 882.

Suppose there are two numbers for which this GCD is greater than 18. Note that $\overline{a a b}-\overline{a b a}=9(a-b)$ is divisible by this GCD. $|a-b| \leqslant 9$ so for the GCD to be greater than 9, it must contain factors from both the number 9 and $a-b$. In particular, for the GCD to be greater than 9, it must be divisible by 3, which means the original numbers are divisible by 3.

For the number $\overline{a a b}$ to be divisible by 3, the numbers $a$ and $b$ must give the same remainder when divided by 3. Therefore, $|a-b|$ can take the values 3, 6, or 9, and consequently, the GCD is a divisor of 27, 54, or 81. If we are interested in a GCD greater than 18, it must be divisible by 9, and more specifically, by 27. This means the number $\overline{a a b}$ is divisible by 9. Under this condition, by the divisibility rule for 9, the digit $a$ almost uniquely determines the digit $b$.

Thus, as $\overline{a a b}$, it makes sense to consider only the numbers 117, 225, 333, 441, 558, 666, 774, 882, 990, and 999 (some of these do not fit because $a \neq b$, in particular, 999. The remaining numbers form two arithmetic progressions with a common difference of 108 each). Since 108 is divisible by 27, it is enough to check that 117 and 558 are not divisible by 27, and the other numbers will also not be divisible.

Thus, the GCD is not divisible by 27. Therefore, 18 is the greatest option.

## 9th grade

#