Problem

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

Tags: combinatorics, game, Tournament of Towns



There are $n{}$ 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 $n{}$ does the first player have a strategy so that he wins no matter how the other player plays? Fedor Ivlev