11.7. Find all permutations $\left(a_{1}, a_{2}, \ldots, a_{2021}\right)$ of the numbers $1,2, \ldots, 2021$ such that for any natural numbers $m, n$ satisfying the condition $|m-n|>20^{21}$, the inequality holds:

$$
\sum_{i=1}^{2021} \operatorname{GCD}\left(m+i, n+a_{i}\right)<2|m-n|
$$

(A permutation ( $a_{1}, a_{2}, \ldots, a_{2021}$ ) is a sequence in which each of the numbers $1,2, \ldots, 2021$ appears exactly once.)

(P. Kozlov)
Answer. The identity permutation, that is, $a_{i}=i$.

Solution. Consider the permutation $\left(a_{1}, a_{2}, \ldots, a_{2021}\right)$, for which the condition of the problem is satisfied. Let $d_{i}=i-a_{i}$. Obviously, the sum of all numbers $d_{i}$ is zero. Suppose not all $d_{i}$ are 0, in such a case there exist indices $j, k$ such that $d_{j}<0$ and $d_{k}>0$. Let $r=20^{21}\left(d_{k}-d_{j}\right)-d_{j}+1$, then $\gcd(r+d_{j}, r+d_{k})=\gcd(r+d_{j}, d_{k}-d_{j})=1$. By the Chinese Remainder Theorem, there exists an integer $m>r$ such that $m+j$ is divisible by $r+d_{j}$ and $m+k$ is divisible by $r+d_{k}$. Then for the pair of natural numbers $(m, n)=(m, m-r)$, first, $|m-n|=r>20^{21}$, and second, the inequality

2021

$$
\begin{aligned}
& \sum_{i=1} \gcd(m+i, n+a_{i}) \geqslant \\
& \quad \geqslant \gcd(m+j, n+a_{j})+\gcd(m+k, n+a_{k})+2019= \\
& =\gcd(m+j, -r-d_{j})+\gcd(m+k, -r-d_{k})+2019= \\
& \quad=(r+d_{j})+(r+d_{k})+2019=2 r+d_{j}+d_{k}+2019 \geqslant
\end{aligned}
$$

$$
\geqslant 2 r-2020+1+2019=2 r=2|m-n|,
$$

which contradicts the choice of the permutation. Therefore, all $d_{i}$ are 0, and the permutation $\left(a_{1}, a_{2}, \ldots, a_{2021}\right)$ is the identity permutation, that is, $a_{i}=i$.

Lemma. Let natural numbers $A, \ell \geqslant 2$ satisfy the inequality $A>\ell^{3}$. Denote by $S(n)$ the sum $\sum_{i=1}^{\ell} \gcd(A, n+i)$. Then $S(n) \leqslant \ell^{3}$, which contradicts our assumption.

The fact that the identity permutation satisfies the condition of the problem follows from the lemma with $A=|m-n|, \ell=2021$ and the equality $\gcd(m+i, n+i)=\gcd(m-n, n+i)$.