Jump to content

Fibonacci nim

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by David Eppstein (talk | contribs) at 01:41, 22 March 2021 (Strategy: image of Zeckondorf representations). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Fibonacci nim is played with a pile of coins

Fibonacci nim is a mathematical subtraction game, a variant of the game of nim. The game was first described by Michael J. Whinihan in 1963, who credits its invention to Robert E. Gaskell. It is called Fibonacci nim because the Fibonacci numbers feature heavily in its analysis.[1]

Rules

Fibonacci nim is played by two players, who alternate removing coins or other counters from a pile. On the first move, a player is not allowed to take all of the coins, and on each subsequent move, the number of coins removed can be any number that is at most twice the previous move. According to the normal play convention, the player who takes the last coin wins.[2]

This game should be distinguished from a different game, also called Fibonacci nim, in which players may remove any Fibonacci number of coins on each move.[3]

Strategy

Visual representation of the Zeckondorf representations of each number (a row of the image) as a sum of Fibonacci numbers (the widths of rectangles intersecting that row). The optimal strategy in Fibonacci nim removes the smallest rectangle in the row for the current pile of coins, leaving a pile described by the remaining rectangles from that row.

The optimal strategy in Fibonacci nim (under the normal play convention) can be described using the Zeckendorf representation of the current number of coins as a sum of non-consecutive Fibonacci numbers, and using a number called the "quota". The quota may be denoted q, and is defined as the maximum number of coins that can currently be removed. On the first move, all but one coin can be removed, so if the number of coins is n then the quota is q = n − 1. On subsequent moves, the quota is two times the previous move. Based on these definitions, a given position is a losing position for the player who is about to move when q is less than the smallest Fibonacci number in the Zeckendorf representation, and a winning position otherwise. In a winning position, it is always a winning move to remove all the coins (if this is allowed) or otherwise to remove a number of coins equal to the smallest Fibonacci number in the Zeckendorf representation. When this is possible, the opposing player will necessarily be faced with a losing position, because the new quota will be smaller than the smallest Fibonacci number in the Zeckendorf representation of the remaining number of coins. From a losing position, any move will lead to a winning position.[1]

In particular, when the starting pile has a Fibonacci number of coins, the Zeckendorf representation consists of that one number, and the quota n − 1 is smaller than that number. Therefore, a starting pile of this form is losing for the first player and winning for the second player. However, whenever the starting number of coins is not a Fibonacci number, the first player can always win.[2] In this case, the quota-based strategy would remove the smallest number in the Zeckendorf representation of the starting pile, but in general there may be multiple possible winning moves.[4]

Example

For example, suppose that there are initially 10 coins. The Zeckondorf representation is 10 = 8 + 2, so a winning move by the first player would be to remove the smallest Fibonacci number in this representation, 2, leaving 8 coins. The second player can remove at most 4 coins, but removing 3 or more would allow the first player to win immediately, so suppose that the second player takes 2 coins. This leaves 6 = 5 + 1 coins, and the first player again takes the smallest Fibonacci number in this representation, 1, leaving 5 coins. The second player could take two coins, but that would again lose immediately, so the second player takes only one coin, leaving 4 = 3 + 1. The first player again takes the smallest Fibonacci number in this representation, 1, leaving 3 coins. Now, regardless of whether the second player takes one or two coins, the first player will win the game in the next move.[5]

Multiple piles

Fibonacci nim is an impartial game in that the moves that are available from any position do not depend on the identity of the player who is about to move. Therefore, the Sprague–Grundy theorem can be used to analyze an extension of the game in which there are multiple piles of coins, and each move removes coins from only one pile (at most twice as many as the previous move from the same pile). For this extension, it is necessary to compute the nim-value of each pile; the value of the multi-pile game is the nim-sum of these nim-values. However, a complete description of these values is not known.[6]

A different multiple-pile variant of the game that has also been studied limits the number of stones in each move to twice the number from the previous move, regardless of whether that previous move was to the same pile.[7]

References

  1. ^ a b Whinihan, Michael J. (1963), "Fibonacci Nim" (PDF), Fibonacci Quarterly, 1 (4): 9–13.
  2. ^ a b Vajda, Steven (2007), "Fibonacci nim", Mathematical Games and How to Play Them, Dover Books on Mathematics, Courier Corporation, pp. 28–29, ISBN 9780486462776.
  3. ^ For the game of subtracting Fibonacci numbers of coins, see Alfred, Brother U. (1963), "Exploring Fibonacci numbers" (PDF), Fibonacci Quarterly, 1 (1): 57–63, "Research project: Fibonacci nim", p. 63; Pond, Jeremy C.; Howells, Donald F. (1963), "More on Fibonacci nim" (PDF), Fibonacci Quarterly, 1 (3): 61–62.
  4. ^ Allen, Cody; Ponomarenko, Vadim (2014), "Fibonacci Nim and a full characterization of winning moves", Involve, 7 (6), doi:10.2140/involve.2014.7.807
  5. ^ The fact that 2 is the unique winning move from this starting position, and the Zeckondorf representations of all pile sizes arising in this example, can be seen in Allen & Ponomarenko (2014), Table 1, p. 818.
  6. ^ Larsson, Urban; Rubinstein-Salzedo, Simon (2016), "Grundy values of Fibonacci nim", International Journal of Game Theory, 45 (3): 617–625, arXiv:1410.0332, doi:10.1007/s00182-015-0473-y, MR 3538534.
  7. ^ Larsson, Urban; Rubinstein-Salzedo, Simon (2018), "Global Fibonacci nim", International Journal of Game Theory, 47 (2): 595–611, doi:10.1007/s00182-017-0574-x, MR 3842045