[Math] Game: removing coins from two stacks.

number theorypuzzle

Two Players $A$ & $B$ starts to play game, they play turn by turn, A goes first.

They start with two stacks of $N$ number of coins each, Each player either have to remove one coin each from both of the stacks or remove as much coins ( more than or equal to $1$ ) as he want from any one of those stacks.

The one who makes last move wins.

Given Number of coins in each stack i.e $N$ , can you tell who will win this game if both plays optimally.

Best Answer

The possible moves are

(1 - n) take n coins of the pile 1 (2 - n)take n coins of the pile 2 (3) take one coin of both piles

The trick in this game is to give your player one of the following kinds of patterns:

(a) N ; N (b) N + 1; N + 2 (c) N + 2; N + 1

Where $N$ represents a multiple of 3 (can be 0. In those positions, the other player cannot win in one round, and we can always answer them in such a way we can give them another piles of those kinds.

We will represent B as the player with the winning strategy, and gives to player A one of the referred positions, wlog (a): if A plays (3), B takes one coin, if A plays (1 - n) or (2- n), the:

if n=1 mod 3, B plays n+1 on the other stack

if n=2 mod 3, B plays n-1 on the other stack

if n=0 mod 3, B plays n on the other stack

In that fashion, B always leaves the game in one of the winning kinds. For (b) and (c), the strategy is similar.

Summing up:

Suppose $N$ is 1 module 3, then A has to use (3) and plays as I explain after, having the winning strategy.

Suppose $N$ is 2 module 3, then A has to use (1 - 1) or (2 - 1), i.e. has to take one coin from a pile at choice. Then plays as I explain after, having the winning strategy.

If $3|N$, then B can always answer

Related Question