The strategy for this game of nim is based off mod 8.
If the number of tokens remaining is 0 or 2 mod 8, then the player is in a losing position.
If the number of tokens remaining is 1 mod 8, then the only winning move is to take 1 token.
If the number of tokens remaining is 3 mod 8, then the possible winning moves are to take 1 or 3 tokens.
If the number of tokens remaining is 4 or 6 mod 8, then the only winning move is to take 4 token.
If the number of tokens remaining is 5 mod 8, then the possible winning moves are to take 3 or 5 tokens.
If the number of tokens remaining is 7 mod 8, then the only winning move is to take 5 tokens.
In the case of 30 tokens in the problem: Since 30 mod 8 = 6, The first player can win by taking 4 tokens.
Nikki expands the problem by finding a strategy for all variations of nim which remove any one option from a set of consecutive values starting at 1 (for this problem, 2 was removed from the set 1-5) here and here |