Problem

Source: 2022 Nordic Mathematical Olmpiad

Tags: combinatorial game theory, number theory



Anton and Britta play a game with the set $M=\left \{ 1,2,\dots,n-1 \right \}$ where $n \geq 5$ is an odd integer. In each step Anton removes a number from $M$ and puts it in his set $A$, and Britta removes a number from $M$ and puts it in her set $B$ (both $A$ and $B$ are empty to begin with). When $M$ is empty, Anton picks two distinct numbers $x_1, x_2$ from $A$ and shows them to Britta. Britta then picks two distinct numbers $y_1, y_2$ from $B$. Britta wins if $(x_1x_2(x_1-y_1)(x_2-y_2))^{\frac{n-1}{2}}\equiv 1\mod n$ otherwise Anton wins. Find all $n$ for which Britta has a winning strategy.