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 graphical version (better pictures & formulas)
Go to University of Toronto Mathematics Network
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.
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
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?
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?
D D D D D
Q Q Q Q Q Q
N N N
Go ahead and make your move!
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
D D D
Q Q Q Q Q Q
Now try different starting situations by choosing different
numbers from the popup menus below, then select
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.
This page last updated: May 26, 1998
Original Web Site Creator / Mathematical Content Developer:
Current Network Coordinator and Contact Person:
Joel Chan - firstname.lastname@example.org
Navigation Panel: Up | Down to First Subsection | Forward (skipping subsections) | Graphical Version | U of T Math Network Home