Problem

Source: 2019 RMM Shortlist C3

Tags: combinatorics, divisible, permutation



Fix an odd integer $n > 1$. For a permutation $p$ of the set $\{1,2,...,n\}$, let S be the number of pairs of indices $(i, j)$, $1 \le i \le j \le n$, for which $p_i +p_{i+1} +...+p_j$ is divisible by $n$. Determine the maximum possible value of $S$. Croatia