Problem

Source: Polish Math Olympiad 2021 2nd round p3 day 2

Tags: combinatorics, permutations, number theory



Let $p\ge 5$ be a prime number. Consider the function given by the formula $$f (x_1,..., x_p) = x_1 + 2x_2 +... + px_p.$$Let $A_k$ denote the set of all these permutations $(a_1,..., a_p)$ of the set $\{1,..., p\}$, for integer number $f (a_1,..., a_p) - k$ is divisible by $p$ and $a_i \ne i$ for all $i \in \{1,..., p\}$. Prove that the sets $A_1$ and $A_4$ have the same number of elements.