How many games must be played for B to win at least 20 matches?

148 Views Asked by At

Two players $A$ and $B$ play a game in which they alternatively take out 2, 3 or 5 balls from a bag. As soon as a player is unable to pick again, he/she loses the game. Players are smart enough not to risk their match with a wrong move, and thus follow an optimal strategy. $N$ matches are planned, and there are $N$ number of balls in the $N^{th}$ match. Matches are started by player $A$. What is the minimum value of $N$ for which B has won at least 20 matches?

a) 69
b) 50
c) 71
d) 70

My attempt: I just started from the first match and recorded who will win, but then I realized this approach is going to be too long. How can I solve this question?

1

There are 1 best solutions below

3
On BEST ANSWER

If someone is left with one ball, this person can no longer select two, three or five balls. For two, three, four, five and six balls, there is always a solution which leaves your opponent with an invalid move (two, two, three, five and five respectively). When there are seven or eight balls left, the opponent can always make a move which leaves you with an invalid option, because you will leave either five, four or two balls in the former case, and six, five or three balls in the latter (which, as explained above, have an optimal solution for the opponent). Taking this into account, the series becomes the following:

 1 - B
 2 - A
 3 - A
 4 - A
 5 - A
 6 - A
 7 - B
 8 - B
 9 - A
10 - A
11 - A
12 - A
13 - A
14 - B
15 - B
16 - A
....

Once you are against $7n$ or $7n + 1$ remaining balls, the opponent can always make a move which will again leave you with $7n'$ or $7n' + 1$ balls. This can continue until $n = 0$, in which case you lose (since you are left with either one ball or no balls at all). As such, B needs to play 70 games (20 of which equal $7n$ or $7n + 1$ for a certain $n$) in order to win at least 20 games.