MathDB
game with the sum of the digits

Source: 2022 Centroamerican and Caribbean Mathematical Olympiad, P1

December 1, 2022
game strategycombinatorics

Problem Statement

There is a pile with 2022 rocks. Ana y Beto play by turns to the following game, starting with Ana: in each turn, if there are nn rocks in the pile, the player can remove S(n)S(n) rocks or nāˆ’S(n)n-S(n) rocks, where S(n)S(n) is the sum of the the digits of nn. The person who removes the last rock wins. Determine which of the two players has a winning strategy and describe it.