Problem

Source: Kyiv City MO 2024 Round 1, Problem 11.3

Tags: game, number theory, combinatorics, Divisibility



Let $n>1$ be a given positive integer. Petro and Vasyl play the following game. They take turns making moves and Petro goes first. In one turn, a player chooses one of the numbers from $1$ to $n$ that wasn't selected before and writes it on the board. The first player after whose turn the product of the numbers on the board will be divisible by $n$ loses. Who wins if every player wants to win? Find answer for each $n>1$. Proposed by Mykhailo Shtandenko, Anton Trygub