You and someone else play the following game The problem is
You and someone else play the following game. The problem is to figure out your best strategy and whether you can guarantee a win. There are N coins in a pile. You and your opponent alternate taking coins from the pile. (Coins removed are not replaced.) The requirement is that each player must remove at least one coin, but not more than four, in any one turn. In one version of the game the person who takes the last coin(s) wins, while in the other that person loses. For instance, suppose the object is to take the last coin. If N=4 you can take all four and win, but if N=5 no matter what you do your opponent can take the rest of the coins after you and win. If the objective is to force your opponent to take the last coin, you can win if you start with 2, 3, 4, or 5, but not if you start with 1. Figure out the ideal strategy in each case and determine for which values of N you can ensure a win by following the correct strategy.
Solution
case 1:
N=2
you go first and pick 1 coin and then your friend will pick the other remaining coin and you will win as the last coin was picked by your friend.
case 2:
N=3
you go first you pick just 1 coin and then you friend gets two coins again you will win.
you go first you pick 2 coins and your friend is left with the last coin again you will win as your friend picks the last coin.
your friend goes first and draws just 1 coin and its your turn and you too draw just 1 coin so your friend will have to pick the last coin and hence you will win again.
case 3:
N=4
you go first and pick 2 or 3 coins
and you friend picks 2 coins against your 2 or 1 coin againts your 3 in both these situations you will win as your friend picks the last coin.
case 4:
N=5
you go first and you pick 2 coins and your frien picks the remaining 3.
you pick 2 coins your friend picks 1 coin then you pick 1 coin and finally your friend has to pick the las coin and you will win.
you pick 3 coins and you friend picks the remaining 2 coins , here as well yuo will win.
you pick 4 coiins and your friend has to pick the last coin and again you will win.
the ideal stratigy would be to leave atleast 1 coin but not more then 4 and hope that your friend picks all the remaining coins.
