August 23, 2007

The Number Pad Game

The number pad of a computer keyboard or calculator presents a three-by-three array of the digits from 1 to 9. (We exclude the digit 0, which is usually in a row by itself.) This array of numbers can serve as the basis of a simple, two-player game.

In the game, the first player turns on (or clears) the calculator, presses a digit key, then presses the + key. The second player responds by pressing a digit key in the same row or column as the last digit key pressed by the first player, except the key pressed by the first player. So, if player A presses 5, player B can respond with 4, 8, 6, or 2, but not with 5.

The first player responds to the second player's move in the same way. The two players take turns alternately until a player reaches a sum greater than a specified amount, say 30. That player loses.

Is there a winning strategy for this game? How does it depend on the specified "fatal" total?

"You can visualize the game as being played by stacking wooden blocks on top of one another," Alex Fink and Richard Guy write in the September College Mathematics Journal. "When the height exceeds 30 blocks, the stack topples and the player who was responsible loses."

For a tower of "tolerable" height 30, player A can win by touching 9 on the first move. No matter how B moves, A can always ensure that B exceeds 30. A can also win by starting with 3, but B can prolong the game by touching 1 at each turn.

Fink and Guy also work out the winning moves for any "tallest tolerable tower." For example, as noted above, the winning initial moves for 30 are 3 and 9. Interestingly, there is always a winning first move for the first player unless the tallest tolerable towers are 27, 43, or 64 in height. For 27, 43, or 64, there is no such strategy for the first player.

For shorter towers, you have to pay attention and pick your opening move carefully. However, that changes for heights greater than 107. "For towers taller than 107, you can always win by playing 3, 5, or 7—your opponent can never reply with one of these numbers, and whatever is played, you can reply with either of two of them," Fink and Guy report.

You can also reverse the rules and play the game so that the first player to exceed the total wins (rather than loses). Under this rule, there are no winning moves for towers of 12, 42, 76, 97, and 40k + 114. Curiously, beyond 124, the set of winning moves repeats itself with a period of 80. So, the same winning initial moves work for towers of 125 and 205, and so on!

Other variants of the game are possible. Fink and Guy consider configurations that include the 0 key in a separate row and look at how what happens depends on whether the key is in the middle, left, or right column—or even straddles two columns.

Any of these game variants can be a pleasant pastime. In some cases, the patterns of winning moves are simple enough to master that you could have a distinct advantage over any friends who dare to take on the challenge.


Fink, A., and R. Guy. 2007. The number-pad game. College Mathematics Journal 38(September):260-264.

No comments: