2. Let's say a positive integer $k$ is fair if the number of 2021-digit palindromes that are multiples of $k$ is the same as the number of 2022-digit palindromes that are multiples of $k$. Does the set $M=\{1,2, \ldots, 35\}$ contain more numbers that are fair or more numbers that are not fair?

(A palindrome is a natural number whose decimal representation reads the same from left to right as from right to left.)

(David Hruška, Josef Tkadlec)
SOLUTION. We will show that the given 35-element set $M$ contains at least 18 fair numbers, which is more than the number of numbers in it that are not fair.

It suffices to prove that every positive divisor of the number $2^{1010} \cdot 3^{2} \cdot 5^{1010}$ is a fair number. From this, it follows that all 18 numbers in the subset

$$
S=\{1,2,3,4,5,6,8,9,10,12,15,16,18,20,24,25,30,32\}
$$

of set $M$ are fair. The idea of proving the fairness of each $k$ with the property $k \mid 2^{1010} \cdot 3^{2} \cdot 5^{1010}$ will be presented immediately after we divide all palindromes of lengths 2021 and 2022 into suitable groups, introduce useful notation for them, and add insights about divisibility that will clarify the subsequent proof.

Consider any 1010-digit number $n$ and denote by $A_{n}$ (resp. $B_{n}$) the set of 2021-digit (resp. 2022-digit) palindromes whose first 1010 digits are given by $n$. This way, we have divided all the palindromes under consideration into groups $A_{n}$ and $B_{n}$, where the numbers in the same group not only share the first but also the last 1010 digits. Therefore, to specify a number from $A_{n}$, resp. $B_{n}$, it suffices to determine its middle digit, resp. its middle two-digit number, and this can be done by any choice from the set

$$
J=\{0,1,2, \ldots, 9\}, \quad \text { resp. } \quad D=\{00,11,22,33,44,55,66,77,88,99\}
$$

Thus, there are exactly 10 numbers in $A_{n}$ and $B_{n}$, and we will denote them by the notations $[n, j]$, resp. $[n, d]$, where $j \in J$ and $d \in D$. The fact that all palindromes $[n, j]$ and $[n, d]$ with a given $n$ end with the 1010-digit number obtained by reading the number $n$ from right to left will have two consequences for us: The numbers $[n, j]$ and $[n, d]$ give the same remainders as the numbers $2 n+j$, resp. $2 n+d$ (since $10^{i} \equiv 1 \quad(\bmod 9)$ for every integer $i \geqq 0$), and their divisibility by $2^{a}$ and $5^{a}$, where $a \in\langle 1,1010\rangle$ is an integer, is determined by the first $a$ digits of the given $n$.

We are now ready to prove the fairness of every number $k=2^{a} \cdot 3^{b} \cdot 5^{c}$, where $a, c \in\langle 0,1010\rangle$ and $b \in\langle 0,2\rangle$ are (and everywhere else) integers. To do this, we will show that the number of multiples of such a $k$ is the same in both sets $A_{n}$ and $B_{n}$, regardless of the permissible $n$. By summing these counts over all possible 1010-digit numbers $n$, we will then obtain the desired conclusion.

The statement about the same number of multiples of a given $k$ in the sets $A_{n}$ and $B_{n}$ with a given (and everywhere else fixed) number $n$ is obvious in the case $k=1$ (both counts are 10). For other specified $k$, we will distinguish 4 cases, in which we will use the insights about divisibility (from the third paragraph of the solution) without reference.

a) Case $k=2^{a} 5^{c}$, where $\max (a, c) \in\langle 1,1010\rangle$. The divisibility of the numbers $[n, j]$ and $[n, d]$ by such a number $k$ is determined by the first $\max (a, c)$ digits of the number $n$, so the statement holds - either all numbers in $A_{n}$ and $B_{n}$ (ten each) are multiples of $k$, or none of the numbers in $A_{n}$ or $B_{n}$ are.

b) Case $k=3^{2}=9$. The numbers $[n, j]$ and $[n, d]$ give the same remainder when divided by nine as the numbers $2 n+j$, resp. $2 n+d$. The remainders of the numbers $d \in D$ when divided by nine are, according to the notation of $D$ in a), in order $0,2,4,6,8,1,3,5,7,0$, i.e., each remainder except zero occurs once and zero occurs twice. Therefore, if $n$ is a multiple of nine, the sets $A_{n}, B_{n}$ contain two multiples of nine each, otherwise one multiple of nine each.

c) Case $k=3^{1}$. The numbers $[n, j]$ and $[n, d]$ can be replaced modulo 3 by the numbers $2 n+j$, resp. $2 n+d$. When divided by three, the numbers $j \in J$ give remainders in order $0,1,2,0,1,2,0,1,2,0$ and the two-digit numbers $d \in D$ give remainders $0,2,1,0,2,1,0,2,1,0$. Therefore, if $n$ is a multiple of three, both sets $A_{n}, B_{n}$ contain four multiples of three each, otherwise three multiples of three each.

d) Case $k=2^{a} \cdot 3^{b} \cdot 5^{c}$, where $\max (a, c) \in\langle 1,1010\rangle$ and $b \in\langle 1,2\rangle$. Consider first the number $k^{\prime}=2^{a} 5^{c}$. From the proof of case a) it follows that either all numbers in $A_{n}$ and $B_{n}$ are multiples of $k^{\prime}$, or none of them are. If the first possibility occurs, from the result of the case $k=3^{b}$ it follows that both sets $A_{n}$ and $B_{n}$ contain the same number of multiples of $3^{b}$, and thus also of the number $3^{b} \cdot k^{\prime}=k$. If the second possibility occurs, neither of the sets $A_{n}$, $B_{n}$ contains a multiple of $k^{\prime}$, and thus no multiple of $k$.

This completes the entire solution.

NOTE. Using a computer, it can be verified that the given set $M$ contains exactly 18 fair numbers, which we have thus determined in full.