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
Problem
Source: 42nd International Tournament of Towns, Junior O-Level P3, Fall 2020
Tags: combinatorics, game, Tournament of Towns
Philomath_314
18.02.2023 15:58
oVlad wrote:
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
https://math.stackexchange.com/questions/4043721/for-which-n-the-first-player-has-a-strategy-so-that-he-wins-no-matter-how-the
CrazyInMath
12.03.2023 08:19
I used candies instead of stones, but who cares?
We claim that $n=4k$ are the only losing points in this game.
We use strong induction on $n$.
First, it's easy to check that $n=1,2,3,4$ works, so the base cases works.
Now let's assume this is correct for all $n\leq4t$, we will prove that it is also correct for $n=4t+1,4t+2,4t+3,4t+4$.
For $4t+1$ just take $1$ candy, for $4t+2$ take two candies,
for $4t+3$ there would be a prime $p|4t+3$ satisfying $p\equiv 3\pmod{4}$, take $p$ candies.
for $4t+4$ note that there isn't a prime that is a mutiple of $4$, so any move will send your opponent to a winning point.
So $4t+1,4t+2,4t+3$ are winning points and $4t+4$ is a losing point, and we're done by strong induction.