*Wednesday, May 31st, 2017*

In this post, we will learn how to solve Logical Reasoning Problems based on coins and matchsticks picking puzzles. To understand how exactly these kinds of puzzles look like, let’s start the post with a very simple example. The method to solve the example will give better insight so as to how to approach these puzzles.

*Two smart players A and B are playing a coin game in which they can pick up 1, 2, 3 or 4 coins. They have 78 coins and the player who picks the last coin will lose the game. A and B play alternately and A plays the first move. How many coins should A pick at first so his win is independent of number of coins B picks in his first move?*

**Method to solve:**

To win the game A must leave only 1 coins for B to pick up for B’s last move. If A leaves 2 coins then B will pick up 1 coin forcing A to pick up the last coin. Similar condition is when 3, 4 or 5 coins are left for B to pick after A’s move. Hence, A can leave only 1 coin for B to pick which will make A as the winner. For A’s last move, he should be left with 2, 3, 4 or 5 coins which means his second last move should ensure that only 6 coins are left.

Start analyzing this structure from the bottom. For the B’s last turn only 1 coins is left which means A must have picked up either 1 or 2 or 3 or 4 coins in A’s last turn. This is only possible if A has left only 6 coins for B to pick up in A’s second last turn.

Going with B’s second last turn, he has an option of picking from 6 coins. If he picks 4 coins, A will be left with 2 coins and so A can pick up just 1 coin forcing B to pick up the last one. If B picks up 1 coin, A will be left with 5 coins and so A can pick up 4 coins which again forces B to pick up the last coin.

To get even better understanding, let us make A and B play the game. The number of coins each picks is a number among 1,2,3 or 4. Every time A will try to control the right column of the above table. Since they have 78 coins initially and from the column we see that A wants to leave 76 coins after his first turn, A will pick up 2 coins. Note that number of coins picked by B is a random among 1,2,3 and 4.

Here we can see that A is trying to maintain the controlling factor column shown previously.

A’s controlling factor can be generalized as: (**MIN + MAX)*k + MIN**

** **where k is a natural number

In our example: **min =1, max =4** so the controlling factor is 5k + 1.

In order to find the number of coins A should pick up, the controlling factor is to be the largest number possible but less than the total number of coins. In our example this number is 76.

( 5k + 1) | + | Numer of coins to pick in first turn | = | Total coins | ||||

Numer of coins to pick in first turn | = | Total coins – (5k + 1) | ||||||

Number of coins to pick in first turn | = | (Total coins – 1) -5k |

The number of coins to pick in first turn, from the above equation is the remainder (when total coins -1) is divided by 5, i.e.

The controlling factor is the key to win. This case illustrates the situation when the person who picks the last coin will lose the game. If we change the minimum coins to pick from 1 to 2 and maximum remain as 4, then A should pick 4 coins in his first turn.

This example illustrates the situation when the one who picks the last coin loses the game. What if it’s the other way around? **SOMEONE WHO PICKS THE LAST COIN WINS THE GAME**. Let us take that example as well.

**QUESTION: ***Two smart players A and B are playing a coin game in which they can pick up 1, 2, 3 or 4 coins. They have 78 coins and the player who picks the last coin will win the game. A and B play alternately and A plays the first move. How many coins should A pick at first so his win is independent of number of coins B picks in his first move?*

**Method: ** In this case A would want to pick last coin (he can even pick upto last 4 coins). He wants to leave 0 coins after his last turn. Hence, his control factors this time will start from 0 from the bottom of the table.

If we go through the following table, we can see that the method to solve remains similar to the previous approach, only the control factor changes.

In this case, the controlling factor changes as: **(MIN + MAX)*K**

**WHEN THE REMAINDER (NUMBER OF COINS TO PICK IN FIRST TURN) IS ZERO:**

There might be cases when the number of coins to pick in first turn could come up to be zero (from the formula). Consider the following case.

**QUESTION: ***Two smart players A and B are playing a coin game in which they can pick up 1, 2, 3 or 4 coins. They have 76 coins and the player who picks the last coin will lose the game. A and B play alternately and A plays the first move. How many coins should A pick at first so his win is independent of number of coins B picks in his first move?*

On solving with the methods known, the answer for the number of coins A should pick at first will come out to be zero. But since he has to pick up at least 1 coin, in that case the control factor will shift into the hands of B. Practically, in such a situation A cannot win the game no matter how many coins he picked up in his first move as the control factor will shift to B and since B is also a smart player, he will keep the control factor in his hands and win the game.

**WHEN THE REMAINDER IS LESS THAN THE MINIMUN NUMBER OF COINS:**

In addition to the remainder coming out to be zero, there can be cases where the remainder comes out to be less than the minimum number of coins allowed. Let’s take an example to understand.

**QUESTION***: Two smart players A and B are playing a coin game in which they can pick up 2, 3 or 4 coins. They have 75 coins and the player who picks the last coin will lose the game. A and B play alternately and A plays the first move. How many coins should A pick at first so his win is independent of number of coins B picks in his first move?*

Here, when we try to find the remainder so as to get the number of coins for the first turn, it will come to be 1 but picking 1 coin is not allowed, A has to pick at least 2 coins in his first turn. These type of cases might end in a draw otherwise provided that even if the number of coins remaining for the last turn is less than the minimum but still the last person has to pick them up and he loses. If nothing of such sort is mentioned then to draw the game A would want to leave 1 coin for the last. The control factor will then be (min + max)*k + 1 and so the minimum number of coins A will pick up to maintain this control factor will be 2 as per

A very general formula which will help in all kinds of coin problems can be expressed as:

Where, ‘coins to be left for last turn’ can be changed as per the given situation of the question. We’ve already derived the same for some cases but logically thinking about the number of coins one would want to leave to win the game for other person’s last turn will give us the number of coins he should pick up at the start. In some questions instead of coins, matchsticks can be used but still the approach remains the same.

Amazing. Found it somewhere in the LR books,but the explanation was not so clear there.