Fibonacci nim is a mathematical subtraction game, a variant of the game of nim. Players alternate removing coins from a pile, on each move taking at most twice as many coins as the previous move, and winning by taking the last coin. The Fibonacci numbers feature heavily in its analysis; in particular, the first player can win if and only if the starting number of coins is not a Fibonacci number. A complete strategy is known for best play in games with a single pile of counters, but not for variants of the game with multiple piles.
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. [1]
The game was first described by Michael J. Whinihan in 1963, crediting its invention to Oregon State University mathematician Robert E. Gaskell. It is called Fibonacci nim because the Fibonacci numbers feature heavily in its analysis. [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]
The strategy for best play in Fibonacci nim involves thinking of the current number of coins as a sum of Fibonacci numbers. [2] There are many ways of representing numbers as sums of Fibonacci numbers, but only one representation that uses each Fibonacci number at most once, and avoids consecutive pairs of Fibonacci numbers; this unique representation is known as its Zeckendorf representation. For instance, the Zeckendorf representation of 10 is 8 + 2; although 10 can also be represented as sums of Fibonacci numbers in other ways, such as 5 + 5 or 5 + 3 + 2, those other ways do not meet the condition of only using each Fibonacci number once and avoiding consecutive pairs of Fibonacci numbers such as the pairs 2, 3 and 3, 5. The Zeckendorf representation of any number may be found by a greedy algorithm that repeatedly subtracts the largest Fibonacci number possible, until reaching zero. [4]
The game strategy also involves a number called the "quota", which may be denoted as q. This is 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. [2]
Based on these definitions, the player who is about to move can win whenever q is greater than or equal to the smallest Fibonacci number in the Zeckendorf representation, and will lose (with best play from the opponent) 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. [2] Other winning moves may also be possible. [5] However, from a losing position, all moves will lead to winning positions. [2]
The Zeckendorf representation of a Fibonacci number consists of that one number. So when the starting pile has a Fibonacci number n of coins, the smallest Fibonacci number in the Zeckendorf representation is just n, larger than the starting quota n− 1. Therefore, a Fibonacci number as the starting pile is losing for the first player and winning for the second player. However, any non-Fibonacci starting number of coins has smaller Fibonacci numbers in its Zeckendorf representation. These numbers are not larger than the starting quota, so whenever the starting number of coins is not a Fibonacci number, the first player can always win. [1]
For example, suppose that there are initially 10 coins. [6]
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. [7]
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. [8]
Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps or piles. On each turn, a player must remove at least one object, and may remove any number of objects provided they all come from the same heap or pile. Depending on the version being played, the goal of the game is either to avoid taking the last object or to take the last object.
In combinatorial game theory, the Sprague–Grundy theorem states that every impartial game under the normal play convention is equivalent to a one-heap game of nim, or to an infinite generalization of nim. It can therefore be represented as a natural number, the size of the heap in its equivalent game of nim, as an ordinal number in the infinite generalization, or alternatively as a nimber, the value of that one-heap game in an algebraic system whose addition operation combines multiple heaps to form a single equivalent heap in nim.
In mathematics and computing, Fibonacci coding is a universal code which encodes positive integers into binary code words. It is one example of representations of integers based on Fibonacci numbers. Each code word ends with "11" and contains no other instances of "11" before the end.
In combinatorial game theory, an impartial game is a game in which the allowable moves depend only on the position and not on which of the two players is currently moving, and where the payoffs are symmetric. In other words, the only difference between player 1 and player 2 is that player 1 goes first. The game is played until a terminal position is reached. A terminal position is one from which no moves are possible. Then one of the players is declared the winner and the other the loser. Furthermore, impartial games are played with perfect information and no chance moves, meaning all information about the game and operations for both players are visible to both players.
In mathematics, the nimbers, also called Grundy numbers, are introduced in combinatorial game theory, where they are defined as the values of heaps in the game Nim. The nimbers are the ordinal numbers endowed with nimber addition and nimber multiplication, which are distinct from ordinal addition and ordinal multiplication.
21 (twenty-one) is the natural number following 20 and preceding 22.
Combinatorial game theory is a branch of mathematics and theoretical computer science that typically studies sequential games with perfect information. Study has been largely confined to two-player games that have a position that the players take turns changing in defined ways or moves to achieve a defined winning condition. Combinatorial game theory has not traditionally studied games of chance or those that use imperfect or incomplete information, favoring games that offer perfect information in which the state of the game and the set of available moves is always known by both players. However, as mathematical techniques advance, the types of game that can be mathematically analyzed expands, thus the boundaries of the field are ever changing. Scholars will generally define what they mean by a "game" at the beginning of a paper, and these definitions often vary as they are specific to the game being analyzed and are not meant to represent the entire scope of the field.
In combinatorial game theory, star, written as or , is the value given to the game where both players have only the option of moving to the zero game. Star may also be denoted as the surreal form {0|0}. This game is an unconditional first-player win.
Chomp is a two-player strategy game played on a rectangular grid made up of smaller square cells, which can be thought of as the blocks of a chocolate bar. The players take it in turns to choose one block and "eat it", together with those that are below it and to its right. The top left block is "poisoned" and the player who eats this loses.
In mathematics, Zeckendorf's theorem, named after Belgian amateur mathematician Edouard Zeckendorf, is a theorem about the representation of integers as sums of Fibonacci numbers.
Hackenbush is a two-player game invented by mathematician John Horton Conway. It may be played on any configuration of colored line segments connected to one another by their endpoints and to a "ground" line.
In mathematics, the mex of a subset of a well-ordered set is the smallest value from the whole set that does not belong to the subset. That is, it is the minimum value of the complement set.
Wythoff's game is a two-player mathematical subtraction game, played with two piles of counters. Players take turns removing counters from one or both piles; when removing counters from both piles, the numbers of counters removed from each pile must be equal. The game ends when one player removes the last counter or counters, thus winning.
In mathematics, negafibonacci coding is a universal code which encodes nonzero integers into binary code words. It is similar to Fibonacci coding, except that it allows both positive and negative integers to be represented. All codes end with "11" and have no "11" before the end.
Subtract-a-square is a two-player mathematical subtraction game. It is played by two people with a pile of coins between them. The players take turns removing coins from the pile, always removing a non-zero square number of coins. The game is usually played as a normal play game, which means that the player who removes the last coin wins. It is an impartial game, meaning that the set of moves available from any position does not depend on whose turn it is. Solomon W. Golomb credits the invention of this game to Richard A. Epstein.
Kayles is a simple impartial game in combinatorial game theory, invented by Henry Dudeney in 1908. Given a row of imagined bowling pins, players take turns to knock out either one pin, or two adjacent pins, until all the pins are gone. Using the notation of octal games, Kayles is denoted 0.77.
In mathematics, a sequence of natural numbers is called a complete sequence if every positive integer can be expressed as a sum of values in the sequence, using each value at most once.
In mathematics, the Wythoff array is an infinite matrix of integers derived from the Fibonacci sequence and named after Dutch mathematician Willem Abraham Wythoff. Every positive integer occurs exactly once in the array, and every integer sequence defined by the Fibonacci recurrence can be derived by shifting a row of the array.
In combinatorial game theory, a subtraction game is an abstract strategy game whose state can be represented by a natural number or vector of numbers and in which the allowed moves reduce these numbers. Often, the moves of the game allow any number to be reduced by subtracting a value from a specified subtraction set, and different subtraction games vary in their subtraction sets. These games also vary in whether the last player to move wins or loses. Another winning convention that has also been used is that a player who moves to a position with all numbers zero wins, but that any other position with no moves possible is a draw.
In mathematics, the fibbinary numbers are the numbers whose binary representation does not contain two consecutive ones. That is, they are sums of distinct and non-consecutive powers of two.