Don’t Say 13 and Other Nim Games

by Javier Haro

This week, we will be looking at two different two-player games. “Don’t Say 13” was developed at the San Francisco Math Circle, while Nim is an ancient game possibly originating from China. We’ll analyze strategies for both games and talk about how to create new variations on them. 


Don’t Say 13

The goal of this game is plain and simple: don’t say the number 13! Achieving this goal might be more difficult than it sounds. This game has two players taking turns counting consecutive numbers.  Starting from the number 1, each player chooses to say either the next one or two consecutive numbers.  The players keep counting upward, and whichever player says “13” loses.  Players cannot skip numbers, so they will have to think ahead to make sure they are not forced to count up to 13.

Getting Students Started

These games will go by very quickly, so players should play multiple times. Have students take turns being first player. After a few games, the following questions become interesting to think about:

  • Is there a strategy for winning the game?
  • Does it matter who goes first? Does one player have an advantage?

After players try a few games not saying 13 and develop strategies for winning, have them change up the game!  For example, instead of trying NOT to say “13,” what if the player who says “13” wins? As before, let each player have a chance to be the first player.

How It Works

To see the mathematics behind “Don’t Say 13,” try working backwards and writing down which numbers are good for each player to have said during the games. We can map out which numbers would be the best to say (assuming we are playing to win):

  • If the goal is not to say 13, we want to be the one to say 12. So, the player that says 12 wins.
  • If one player says 10 and 11, we can say 12 to win. Or if one player says 10, we can say 11 and 12 to win! Since saying 10 and 11 or just 10 leads to losing whether you say one or both of those numbers on your turn, the player that says 9 wins!
  • Continuing to work backwards, the other player saying 7 and 8 allows us to say 9. Also, if they say 7 and 8, we will win since we will be able to say 9. Since saying 7 and 8 or just 7 leads to losing, the player that says 6 wins!
  • Lastly, we also don’t want to say 4 and 5 or just 4 either, since we want to say 6. So, the player that says 3 wins!

But you might ask, “Wait!! There are numbers before 3!” There are numbers before 3, but at this point, it’s better just to be second player. No matter what the first player tries, saying 1 and 2 or just 1, the second player is guaranteed a win by following the process above. 

Using the process of working backwards ends up helping us know if it’s better to go first or second for other “Don’t Say __” (insert a number) games. For example, to win “Don’t Say 21,” you want to say 20.  Using the same “working-backwards” logic as before, we see that we want to say 17, 14, 11, 8, 5, and 2.  Going first here is the advantageous position, since we are guaranteed to be able to say 2. We can determine if it’s better to go first or second for other “Don’t Say __” games by counting backwards by 3. 

But figuring out who has the advantage is even easier than that!  This process of counting backward by 3 and seeing what’s left over is exactly the same as dividing by 3 and taking its remainder!  If we want to say 20, we observe that it has a remainder of 2 when divided by 3; therefore, 2, 5, 8, 11, 14, 17 are a class of numbers all with a remainder of 2 when divided by 3.  The way we write this mathematically is 20 ≡ 2 mod 3, read as “20 is congruent to 2 mod 3.”  This area of mathematics is called modular arithmetic.


Screen Shot 2021-02-25 at 8.17.22 PM

For our second activity, 2 players take turns taking beans (or any objects) from a group of 10. On each turn, players can take one or two beans. The goal is to NOT take the last one! This should sound very familiar because it’s exactly like “Don’t Say 13” but with beans! This game is called Nim.

Nim is an ancient game with many variations on the rules.  For example, say two players have 12 objects, like the almonds above, but are arranged so that there are 5 objects in one row, 4 in the next row, and 3 in the last row.  Our goal is that we want to take the last object, but the big difference in this variation is that you can take any amount of objects in any single row.

The above version of Nim with rows may sound very familiar to readers. It is very similar to Puppies and Kittens, but with two slight differences: it has three groups of objects instead of two, and you can’t take an equal amount of objects in multiple rows. Maybe we could call this game “Puppies, Kittens, and Mice”!

Making Variations

There are so many versions that we can make because we can change a few things for both games. To break down what we can change, let’s take a look at the rules of two games we’ve described:

Don’t Say 13

  – Setup: Numbers up to 13
  – Move: Choose 1 or 2 consecutive numbers
  – Goal: Don’t say 13

Puppies, Kittens, and Mice

 – Setup: 12 objects arranged into 3 rows
 – Move: Take any amount from a single row
  Goal: Take the last object

Nim variants can be described broadly in these terms: there is some number of objects, players take turns selecting these objects using different possible moves, and someone wins (or loses) by taking the last object. 

Varying any of the parameters described may change the strategies of the games dramatically. Try to make a new version of either of the games!

Share this post

Scroll to Top
Scroll to Top