NIMGAME - Special Nim Game
In this variant of the Nim game, a pile of N stones is placed between two players. The players take alternating turns and remove some stones. The player who takes the last stone wins.
There are two restrictions however:
- The first player has to remove between 1 and N-1 stones.
- After the first move, the next player has to remove between 1 and 2·k stones, where k is the number of stones removed in the last move.
If both players play perfectly, then it is possible to determine which player will win the game. Note that during the game the game state can be described by the number of remaining stones and the number of stones which can be taken in the next move. Each game state is either a winning position or a losing position.
You have to determine for which values of N (2 ≤ N ≤ 2000) the second player has a winning strategy.
There is no input for this problem.
Print the values N for which the second player has a winning strategy.
Output: 2 3 5 ... 1597
Obviously, the example output is incomplete and shows only the first three values and the last value to be printed.
Awesome problem, really really enjoined solving it :D
Last edit: 2017-01-02 06:50:43
Last edit: 2015-06-29 13:02:24