Subtract a square

Subtract a square

Subtract-a-square (also referred to as take-a-square) is a two-player mathematical game of strategy starting with a positive integer and both players taking turns subtracting a non-zero square number not larger than the current value. The game is usually played as a "normal play" game, which means that the last person who can make a subtraction wins.

Illustration

A normal play game starting with the number 13 is a win for the first player provided he does start with a subtraction of 1: player 1: 13 - 1*1 = 12Player 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:

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:

Normal play 'cold' numbers: 0, 2, 5, 7, 10, 12, 15, 17, 20, 22, 34, 39, 44, ...

This sequence is captured in the On-Line Encyclopedia of Integer Sequences as OEIS2C|id=A030193. 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. [ [http://www.ics.uci.edu/~eppstein/cgt/subsquare.html David Bush: the uniqueness of 11,356] ]

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 theory. This requires the positions in the game subtract-a-square to be mapped onto equivalent nim heap sizes. This mapping is captured for the normal game in the On-Line Encyclopedia of Integer Sequences as OEIS2C|id=A014586. Notice that all 'cold' positions get mapped onto a zero heap size.

Misère game

Subtract-a-square can also be played as a "misère" 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

References


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • T-square (fractal) — In mathematics, the T square is a two dimensional fractal. As all two dimensional fractals, it has a boundary of infinite length bounding a finite area. Its name follows from that for a T square. Algorithmic descriptionIt can be generated from… …   Wikipedia

  • Methods of computing square roots — There are several methods for calculating the principal square root of a nonnegative real number. For the square roots of a negative or complex number, see below. Contents 1 Rough estimation 2 Babylonian method 2.1 Example …   Wikipedia

  • Cyrus Pitt Grosvenor — Born October 18, 1792 Grafton, Massachusetts Died February 11, 1879 Albion, Michigan Nationali …   Wikipedia

  • List of mathematics articles (S) — NOTOC S S duality S matrix S plane S transform S unit S.O.S. Mathematics SA subgroup Saccheri quadrilateral Sacks spiral Sacred geometry Saddle node bifurcation Saddle point Saddle surface Sadleirian Professor of Pure Mathematics Safe prime Safe… …   Wikipedia

  • 142857 (number) — 142,857 is the best known cyclic number in base 10. [ [http://www.daviddarling.info/encyclopedia/C/cyclic number.html Cyclic number ] , The Internet Encyclopedia of Science ] [Michael W. Ecker, [http://links.jstor.org/sici?sici=0049… …   Wikipedia

  • Nim — For other uses, see Nim (disambiguation). Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps. On each turn, a player must remove at least one object, and may remove any number of objects… …   Wikipedia

  • Wythoff's game — is a two player mathematical game of strategy, played with two piles of counters. Players take turns removing counters from one or both piles; in the latter case, the numbers of counters removed from each pile must be equal. The game ends when… …   Wikipedia

  • Grundy's game — is a two player mathematical game of strategy. The starting configuration is a single heap of objects, and the two players take turn splitting a single heap into two heaps of different sizes. The game ends when only heaps of size two and smaller… …   Wikipedia

  • Mental calculation — comprises arithmetical calculations using only the human brain, with no help from calculators, computers, or pen and paper. People use mental calculation when computing tools are not available, when it is faster than other means of calculation… …   Wikipedia

  • Napier's bones — Computing devices in Rabdology Napier s bones Promptuary …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”