MathDB
Game with stones in a heap

Source: 42nd International Tournament of Towns, Junior O-Level P3, Fall 2020

February 18, 2023
combinatoricsgameTournament of Towns

Problem Statement

There are nn{} stones in a heap. Two players play the game by alternatively taking either 1 stone from the heap or a prime number of stones which divides the current number of stones in the heap. The player who takes the last stone wins. For which nn{} does the first player have a strategy so that he wins no matter how the other player plays?
Fedor Ivlev