Skip main navigation

New offer! Get 30% off your first 2 months of Unlimited Monthly. Start your subscription for just £29.99 £19.99. New subscribers only. T&Cs apply

Find out more

The Game of Nim

Watch Yossi Elran’s video on The Game of Nim
Nim is a two-player game The goal of the game is to take the last stone. Whoever takes the last stone, wins. At the beginning of the game, the players decide on the game’s rules, How many piles of stones there are, and how many stones each player is allowed to take from each pile. Let’s take a look at a game of Nim between two players, with one pile of ten stones, and each player can take as many stones as he likes in his turn. Not a very clever game. The first player will always win by taking all the stones in the pile. But suppose there are ten stones in the pile, and each player can take only up to nine stones?
The first player can take up to nine stones. Suppose he takes exactly nine stones. Now the second player takes the remaining stone and wins the game. Of course, the first player doesn’t have to take nine stones. He can take less, but that won’t change the outcome of the game. The second player wins, regardless. Let’s change the rules. We’ll still keep one pile for the moment, but this time, each player is allowed to take one, two or three stones, but no more. Can we deduce who will win this game - the first player or the second player? Is there a general way to analyse Nim? Read the article to find out…

Hopefully, you’ve watched the video and now understand what Nim is, but if you still have some questions, you can post them in the comments and we will try and answer as soon as we can. Other learners are invited and encouraged to answer as well!

This article is from the free online

An Introduction to Recreational Math: Fun, Games, and Puzzles

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now