HOME

TheInfoList



OR:

Subtract-a-square (also referred to as take-a-square) is a two-player mathematical
subtraction game 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 (for instance, the numbers of game tokens in piles of tokens, or the positions of pieces on board) ...
. It is played by two people with a pile of coins (or other tokens) between them. The players take turns removing coins from the pile, always removing a non-zero
square number In mathematics, a square number or perfect square is an integer that is the square (algebra), square of an integer; in other words, it is the multiplication, product of some integer with itself. For example, 9 is a square number, since it equals ...
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 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 betw ...
, 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 Richard Allen Epstein (born April 17, 1943) is an American legal scholar known for his writings on torts, contracts, property rights, law and economics, classical liberalism, and libertarianism. He is the Laurence A. Tisch Professor of Law at ...
..


Example

A normal play game starting with 13 coins is a win for the first player provided they start with a subtraction of 1: player 1: 13 - 1*1 = 12 Player 2 now has three choices: subtract 1, 4 or 9. In each of these cases, player 1 can ensure that within a few moves the number 2 gets passed on to player 2: player 2: 12 - 1*1 = 11 player 2: 12 - 2*2 = 8 player 2: 12 - 3*3 = 3 player 1: 11 - 3*3 = 2 player 1: 8 - 1*1 = 7 player 1: 3 - 1*1 = 2 player 2: 7 - 1*1 = 6 or: 7 - 2*2 = 3 player 1: 6 - 2*2 = 2 3 - 1*1 = 2 Now player 2 has to subtract 1, and player 1 subsequently does the same: player 2: 2 - 1*1 = 1 player 1: 1 - 1*1 = 0 player 2 loses


Mathematical theory

In the above example, the number '13' represents a winning or 'hot' position, whilst the number '2' represents a losing or 'cold' position. Given an integer list with each integer labeled 'hot' or 'cold', the strategy of the game is simple: try to pass on a 'cold' number to your opponent. This is always possible provided you are being presented a 'hot' number. Which numbers are 'hot' and which numbers are 'cold' can be determined
recursively Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics ...
: 1) the number 0 is 'cold', whilst 1 is 'hot' 2) if all numbers 1 .. N have been classified as either 'hot' or 'cold', then 2a) the number N+1 is 'cold' if only 'hot' numbers can be reached by subtracting a positive square 2b) the number N+1 is 'hot' if at least one 'cold' number can be reached by subtracting a positive square Using this algorithm, a list of cold numbers is easily derived: :0, 2, 5, 7, 10, 12, 15, 17, 20, 22, 34, 39, 44, … A faster
divide and conquer algorithm In computer science, divide and conquer is an algorithm design paradigm. A divide-and-conquer algorithm recursively breaks down a problem into two or more sub-problems of the same or related type, until these become simple enough to be solved dire ...
can compute the same sequence of numbers, up to any threshold n, in time O(n\log^2 n). There are infinitely many cold numbers. More strongly, the number of cold numbers up to some threshold n must be at least proportional to the square root of n, for otherwise there would not be enough of them to provide winning moves from all the hot numbers. Cold numbers tend to end in 0, 2, 4, 5, 7, or 9. Cold values that end with other digits are quite uncommon. This holds in particular for cold numbers ending in 6. Out of all the over 180,000 cold numbers less than 40 million, only one ends in a 6: 11,356. No two cold numbers can differ by a square, because if they did then a move from the larger of the two to the smaller would be winning, contradicting the assumption that they are both cold. Therefore, by the
Furstenberg–Sárközy theorem In mathematics, a square-difference-free set is a set of natural numbers, no two of which differ by a square number. Hillel Furstenberg and András Sárközy proved in the late 1970s the Furstenberg–Sárközy theorem of additive number theory s ...
, the
natural density In number theory, natural density (also referred to as asymptotic density or arithmetic density) is one method to measure how "large" a subset of the set of natural numbers is. It relies chiefly on the probability of encountering members of the de ...
of the cold numbers is zero. That is, for every \epsilon > 0, and for all sufficiently large n, the fraction of the numbers up to n that are cold is less than \epsilon. More strongly, for every n there are :O(n/(\log n)^) cold numbers up to The exact growth rate of the cold numbers remains unknown, but experimentally the number of cold positions up to any given threshold n appears to be roughly n^.


Extensions

The game subtract-a-square can also be played with multiple numbers. At each turn the player to make a move first selects one of the numbers, and then subtracts a square from it. Such a 'sum of normal games' can be analysed using the
Sprague–Grundy theorem 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 ...
. This theorem states that each position in the game subtract-a-square may be mapped onto an equivalent nim heap size. Optimal play consists of moving to a collection of numbers such that the
nim-sum 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 ' ...
of their equivalent nim heap sizes is zero, when this is possible. The equivalent nim heap size of a position may be calculated as the minimum excluded value of the equivalent sizes of the positions that can be reached by a single move. For subtract-a-square positions of values 0, 1, 2, ... the equivalent nim heap sizes are :0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 3, 2, 3, 4, … . In particular, a position of subtract-a-square is cold if and only if its equivalent nim heap size is zero. It is also possible to play variants of this game using other allowed moves than the square numbers. For instance, Golomb defined an analogous game based on the
Moser–de Bruijn sequence In number theory, the Moser–de Bruijn sequence is an integer sequence named after Leo Moser and Nicolaas Govert de Bruijn, consisting of the sums of distinct powers of 4, or equivalently the numbers whose binary representations are nonzero on ...
, a sequence that grows at a similar asymptotic rate to the squares, for which it is possible to determine more easily the set of cold positions and to define an easily computed optimal move strategy. Additional goals may also be added for the players without changing the winning conditions. For example, the winner can be given a "score" based on how many moves it took to win (the goal being to obtain the lowest possible score) and the loser given the goal to force the winner to take as long as possible to reach victory. With this additional pair of goals and an assumption of optimal play by both players, the scores for starting positions 0, 1, 2, ... are :0, 1, 2, 3, 1, 2, 3, 4, 5, 1, 4, 3, 6, 7, 3, 4, 1, 8, 3, 5, 6, 3, 8, 5, 5, 1, 5, 3, 7, … .


Misère game

Subtract-a-square can also be played as a ''
misère Misère ( French for "destitution"), misere, bettel, betl, or (German for "beggar"; equivalent terms in other languages include , , ) is a bid in various card games, and the player who bids misère undertakes to win no tricks or as few as possi ...
'' game, in which the player to make the last subtraction loses. The recursive algorithm to determine 'hot' and 'cold' numbers for the misère game is the same as that for the normal game, except that for the misère game the number 1 is 'cold' whilst 2 is 'hot'. It follows that the cold numbers for the misère variant are the cold numbers for the normal game shifted by 1: Misère play 'cold' numbers: 1, 3, 6, 8, 11, 13, 16, 18, 21, 23, 35, 40, 45, ...


See also

* Nim *
Wythoff's game 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 m ...


References

{{reflist Mathematical games Combinatorial game theory Recreational mathematics