PROJECT EULER · #0366
Stone Game III
Two players, Anton and Bernhard, are playing the following game.
There is one pile of
The first player may remove any positive number of stones, but not the whole pile.
Thereafter, each player may remove at most twice the number of stones his opponent took on the previous move.
The player who removes the last stone wins.
E.g.
If the first player takes anything more than one stone the next player will be able to take all remaining stones.
If the first player takes one stone, leaving four, his opponent will take also one stone, leaving three stones.
The first player cannot take all three because he may take at most
So
For some winning positions there is more than one possible move for the first player.
E.g. when
Let
Find
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.