A permutation of the set $\{1, \ldots, 2021\}$ is a sequence $\sigma=\left(\sigma_{1}, \ldots, \sigma_{2021}\right)$ such that each element of the set $\{1, \ldots, 2021\}$ is equal to exactly one term $\sigma_{i}$. We define the weight of such a permutation $\sigma$ as the sum

$$
\sum_{i=1}^{2020}\left|\sigma_{i+1}-\sigma_{i}\right|
$$

What is the greatest possible weight of permutations of $\{1, \ldots, 2021\}$?
Let $n=2021$, and let $\sigma$ be a permutation of $\{1,2, \ldots, n\}$ and let $\mathbf{W}(\sigma)$ be its weight. For all integers $k \leqslant n$, we set

$$
\alpha_{k}=\left\{\begin{array}{ll}
1 & \text { if } k \neq n \text { and } \sigma(k)>\sigma(k+1) \\
0 & \text { if } k=n \\
-1 & \text { if } k \neq n \text { and } \sigma(k)\sigma(k-1) \\
0 & \text { if } k=1 \\
-1 & \text { if } k \neq 1 \text { and } \sigma(k)\sigma_{i}>\sigma_{i+1}$. We then denote by $\sigma^{\prime}$ the permutation of $\{1,2, \ldots, n\}$ defined by:

$$
\begin{aligned}
& \triangleright \sigma_{j}^{\prime}=\sigma_{j} \text { when } 1 \leqslant j \leqslant i-1 ; \\
& \triangleright \sigma_{j}^{\prime}=\sigma_{j+1} \text { when } i \leqslant j \leqslant n-1 ; \\
& \triangleright \sigma_{n}^{\prime}=\sigma_{i} .
\end{aligned}
$$

Since $\left|\sigma_{i}-\sigma_{i+1}\right|+\left|\sigma_{i+1}-\sigma_{i+2}\right|=\left|\sigma_{i}-\sigma_{i+2}\right|$, the weight of $\sigma^{\prime}$ is that of $\sigma$ plus $\left|\sigma_{n}-\sigma_{1}\right|$, which contradicts the maximality of the weight of $\sigma$.
Moreover, and by replacing $\sigma$ with its "horizontal mirror" permutation, i.e., by replacing each term $\sigma_{j}$ with $n+1-\sigma_{j}$, which does not change the weight of $\sigma$, we assume without loss of generality that $\sigma_{1}\sigma_{2 j+1}$ for all integers $j$ such that $1 \leqslant j \leqslant k$.
The weight of $\sigma$ is then

$$
\sum_{j=1}^{k} 2 \sigma_{2 j}-\sigma_{1}-\sigma_{n}-\sum_{j=1}^{k-1} 2 \sigma_{2 j+1}
$$

Since $\sigma$ does not take the same value twice, we have

$$
\begin{aligned}
& \sum_{j=1}^{k} 2 \sigma_{2 j} \leqslant \sum_{j=n+1-k}^{n} 2 j=n(n+1)-(n-k)(n+1-k)=3 k^{2}+3 k \text { and } \\
& \sum_{j=1}^{k-1} 2 \sigma_{2 j+1}+\sigma_{1}+\sigma_{n} \geqslant \sum_{j=1}^{k-1} 2 j+k+(k+1)=k(k-1)+(2 k+1)=k^{2}+k+1
\end{aligned}
$$

Therefore, the weight of $\sigma$ cannot exceed $2 k^{2}+2 k-1=2042219$.
Conversely, the permutation indicated at the end of the previous solution is indeed of weight 2042219, and this is indeed the maximum weight.