Go up to Mathematically Interesting Games
Go down to first subsection Discovering the Mathematics Behind the Game
Go forward to The Tower of Hanoi (skipping over subsections)
Switch to text-only version (no graphics)

# Who Took The Last Coin?

Here is a simple little game you can play against the computer. However, figuring out the mathematical strategy behind the game is not simple at all!

You have a collection of nickels, dimes, and quarters. You and the computer take turns removing coins (you go first). The only restrictions are that each of you must, whenever your turn comes around, take at least one coin and take only one kind of coin. For example, you might take 1 dime, or 7 quarters, but you cannot take a dime and a quarter during a single turn.

The person who takes the last coin wins (though you can change this rule if you like; see Customizing below).

Can you beat the computer? It all depends how many coins you start with. Try playing the game starting from the situations below, then customize your own starting situations.

#### Playing the Game: Situation 1

Try playing the game starting with 3 nickels, 5 dimes, and 6 quarters. The coins are represented below (N = nickel, D = dime, Q = quarter). Select a coin to take it and all coins to the right of it. For example, to take one dime, select the rightmost dime; to take two dimes, select the dime second from the right; to take all the dimes, select the leftmost dime.
N   N   N

Q   Q   Q   Q   Q   Q

Go ahead and make your move. Can you beat the computer? I think you'll find it very difficult! Can you figure out what strategy the computer is using?

#### Playing the Game: Situation 2

Now why don't you try starting with 3 nickels, 3 dimes, and 7 quarters. You should find it easier to beat the computer this time! Can you find a winning strategy?
N   N   N

Q   Q   Q   Q   Q   Q   Q

#### Playing the Game: Customizing

Now that you're familiar with the game, you should have discovered that you can't beat the computer when you start with a (3,5,6) situation (3 nickels, 5 dimes, and 6 quarters). But you can when you start with (3,3,7).

Now try different starting situations by choosing different numbers from the popup menus below, then press "Start Game".

Can you find a mathematical formula that tells you which starting situations you can win from, and which you can't? And, in those situations you can win from, can you find a mathematical formula that tells you what moves to make in order to guarantee a win? Hints are available.

nickel(s), dime(s), quarter(s). Person who takes last coin .