Problem

Source: 2016 Saudi Arabia GMO TST level 4, I p3

Tags: number theory, permutation, divisible



Find all positive integer $n$ such that there exists a permutation $(a_1, a_2,...,a_n)$ of $(1, 2,3,..., n)$ satisfying the condition: $a_1 + a_2 +... + a_k$ is divisible by $k$ for each $k = 1, 2,3,..., n$.