Problem

Source: KJMO 2021 P2

Tags: modular arithmetic, Sequence, Integer sequence, number theory



Let $\{a_n\}$ be a sequence of integers satisfying the following conditions. $a_1=2021^{2021}$ $0 \le a_k < k$ for all integers $k \ge 2$ $a_1-a_2+a_3-a_4+ \cdots + (-1)^{k+1}a_k$ is multiple of $k$ for all positive integers $k$. Determine the $2021^{2022}$th term of the sequence $\{a_n\}$.