Game of stones
Source: Kyiv City MO 2022 Round 2, Problem 7.4
January 30, 2022
combinatoricsgameGCD
Problem Statement
Fedir and Mykhailo have three piles of stones: the first contains stones, the second , the third . They are playing a game, going in turns, Fedir makes the first move. In one move player can select any two piles of stones, let's say they have and stones left correspondently, and remove stones from each of them. The player after whose move some pile becomes empty for the first time wins. Who has a winning strategy?As a reminder, denotes the greatest common divisor of .(Proposed by Oleksii Masalitin)