- About this Journal ·
- Abstracting and Indexing ·
- Advance Access ·
- Aims and Scope ·
- Article Processing Charges ·
- Articles in Press ·
- Author Guidelines ·
- Bibliographic Information ·
- Citations to this Journal ·
- Contact Information ·
- Editorial Board ·
- Editorial Workflow ·
- Free eTOC Alerts ·
- Publication Ethics ·
- Reviewers Acknowledgment ·
- Submit a Manuscript ·
- Subscription Information ·
- Table of Contents

International Journal of Combinatorics

Volume 2011 (2011), Article ID 824742, 9 pages

http://dx.doi.org/10.1155/2011/824742

## Some Remarks on End-Nim

Department of Mathematics, La Trobe University, Melbourne, VIC 3086, Australia

Received 26 September 2011; Accepted 14 November 2011

Academic Editor: Johannes Hattingh

Copyright © 2011 Grant Cairns and Nhan Bao Ho. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

We reexamine Albert and Nowakowski's variation on
the game of Nim, called *End-Nim*, in which the players may only
remove coins from the leftmost or rightmost piles. We reformulate
Albert and Nowakowski's solution to this game. We examine its
misère version and a further variant where the winner is the player
who reduces the game to a single pile; we call this *Loop-End-Nim*.
We show that the three games, End-Nim, misère-End-Nim, and
Loop-End-Nim, all have the same losing positions, except for the
positions where all the piles are of equal size. We also give some
partial results concerning the higher Sprague-Grundy values of the
three games.

#### 1. Introduction

Consider piles of coins, in a row. In the classic game of *Nim*, the two players move alternately, each removing a nonzero number of coins from a single pile; the winner is the player to remove the last coin [1]. The well-known solution to Nim, using Sprague-Grundy values, is both elegant and complete [1].

In [2], Albert and Nowakowski analysed a variation of Nim; they called *End-Nim* in which the players may only remove coins from either of the end piles. This game had been posed as problem 23 in [3], where it was called *Burning the Candle at Both Ends*. Albert and Nowakowski gave a solution to this game, which we recall below, but the Sprague-Grundy values seem particularly complicated and have not yet been determined. In this paper, we examine the misère version of End-Nim, and a further variant where the winner is the player who reduces the game to a single pile; we call this *Loop-End-Nim*, where “Loop" stands for “leave only one pile’’. While Loop-End-Nim is not strictly speaking a misère game, it has something of the nature of a misère game. We show that the three games, End-Nim, misère-End-Nim and Loop-End-Nim, all have the same losing positions (i.e., -positions), except for the positions where all the piles are of equal size. Thus, like the misère form of Nim, the games misère-End-Nim and Loop-End-Nim can be played with the same strategy as End-Nim except that consideration has to be given to the exceptional positions.

The -positions are the positions with Sprague-Grundy value 0. We also give some partial results concerning the positions of higher Sprague-Grundy values of the three games. It should be mentioned here that the Sprague-Grundy function plays no role in the strategy of playing End-Nim, and it is well known that, in their usual form, they are inappropriate for studying misère games [4]. Our interest here is simply to provide further indications as to the complexity of the Sprague-Grundy function for End-Nim.

The positions in these games will be denoted by the corresponding sequences of coin sizes: . The assumption is that the pile sizes are all nonempty. By reversing if necessary, we may assume that .

#### 2. The Losing Positions

In Albert and Nowakowski’s entertaining paper [2], their solution to End-Nim is given in pictorial form, involving a matrix of arrows with asterisks and bullets. We will present it in an alternate form. First, we introduce some notation, employing an idea similar to the one used in [5]. For a position , we define to be the largest natural number for which . Similarly, for a position for which the are not all equal, we define to be the largest natural number for which . If , we set . Then Albert and Nowakowski’s solution can be rephrased as follows.

Theorem 2.1. *In End-Nim, a position with is a -position if and only if one of the following conditions holds:*(a)*, and furthermore, is even,*(b)* and, furthermore, is odd and is even.*

Condition (a) corresponds to the following 8 hieroglyphs of Albert and Nowakowski.

Condition (b) corresponds to the following 4 pictures.

In these pictures, if , then the symbol lies in the first (resp. second) column if is even (resp. odd), and it is adjacent to (resp. ) if (resp. ). The conventions for are defined analogously, for the right hand end. Clearly, our formulation of the result is more succinct, while Albert and Nowakowski’s presentation is more graphic.

To give the solution to misère-End-Nim, we modify slightly the definition of . We set except when , in which case we set . Then we have the following.

Theorem 2.2. *In misère-End-Nim, a position with is a -position if and only if one of the following holds:*(a)* and, furthermore, is even,*(b)* and, furthermore, is odd and is even.*

We postpone the proof until the next section. Let us now describe the solution for Loop-End-Nim. Once again, we modify the function. We set except when , in which case we set . Then we have the following.

Theorem 2.3. *In Loop-End-Nim, a position with is a -position if and only if one of the following holds:*(a)* and, furthermore, is even,*(b)* and, furthermore, is odd and is even.*

As an immediate consequence of the above three results, we have the following.

Corollary 2.4. *The three games, End-Nim, misère-End-Nim, and Loop-End-Nim have the same -positions of the form , where the are not all equal. If where , then*(a)* is a -position of End-Nim if and only if is even,*(b)* is a -position of misère-End-Nim if and only if is even and , or is odd and ,*(c)* is a -position of Loop-End-Nim if and only if is odd.*

#### 3. Proof of Theorems 2.2 and 2.3

*Proof of Theorem 2.2. *We say that a position verifying condition (a) or (b) of Theorem 2.2 is a *0-position*. We must prove two facts:(1) from every position that is not a 0-position, there is a move to a 0-position,(2) there is no move from a 0-position to a 0-position.

(1) Let be a position that is not a 0-position. First suppose that is a -position in End-Nim. By Theorem 2.1, and is even. Then we have the move , which is a 0-position. Now suppose that is not a -position in End-Nim. Then there is a move , where is a -position in End-Nim. If is not a 0-position, then by Theorem 2.1, and is even. Hence either and , or and . In the former case, we have the move , which is a 0-position. In the latter case, since is not a 0-position, and we have the move , which is a 0-position.

(2) Let be a move between two 0-positions, where with and . First suppose that is not a -position in End-Nim. So and is odd. But this is a contraction, since necessarily , which is not a 0-position. So we may suppose that is a -position in End-Nim. Therefore, is not a -position in End-Nim. Hence and is odd. Thus, either and , or and . In the former case, , which is impossible as and is a 0-position. In the latter case, is even and so, as is a 0-position, is also even. Hence . But then , which is impossible as is even and is a 0-position. This completes the proof.

The following argument is modelled closely on the proof we have just given.

*Proof of Theorem 2.3. *We say that a position verifying condition (a) or (b) of Theorem 2.3 is a 0-position. We must prove two facts:(1)from every position that is not a 0-position, there is a move to a 0-position,(2)there is no move from a 0-position to a 0-position.

(1) Let be a position that is not a 0-position. First suppose that is a -position in End-Nim. By Theorem 2.1, and is even. Then we have the move , which is a 0-position. Now suppose that is not a -position in End-Nim. Then there is a move , where is a -position in End-Nim. If is not a 0-position, then by Theorem 2.1, and is even. Hence either and , or . In the former case, we have the move , which is a 0-position. In the latter case, is odd and at first sight there are two possibilities:

(a). Here we have the move , which is a 0-position since .(b). Note that as is not a 0-position, . Here we have the move , which is a 0-position.

(2) Let be a move between two 0-positions, where with and . First suppose that is not a -position in End-Nim. So and is odd. Then either and , in which case , or and . But in both cases, is not a 0-position, which gives a contradiction. So we may suppose that is a -position in End-Nim. Therefore, is not a -position in End-Nim. Hence, and is odd. Thus, either and , or . In the former case, , which is impossible as and is a 0-position. In the latter case, is even and at first sight there are two possibilities:

(a). Here, , which is odd, contrary to the assumption that is a 0-position.(b). Since is a 0-position and is even, we have . But then , again contracting the assumption that is a 0-position.

#### 4. Sprague-Grundy Values for Games with Two Piles

Let us denote the Sprague-Grundy function for the games End-Nim, misère-End-Nim, and Loop-End-Nim by , respectively. First observe that End-Nim with two piles is the same as Nim with two piles. So we have , where denotes Nim addition. The situation regarding Loop-End-Nim is also very simple.

Proposition 4.1. *In Loop-End-Nim, , for all .*

* Proof. *We will prove that by induction on . Clearly . Suppose . Then by induction

The situation concerning misère-End-Nim seems to be considerably more complicated. Indeed, as far as we are aware, even for two piles, where the game is just misère Nim, the Sprague-Grundy function has not yet been determined! We have only been able to obtain very partial information. From Theorem 2.2, a position has Sprague-Grundy value 0 if and only if . We also have the following.

Proposition 4.2. *In the misère-End-Nim, a position with has Sprague-Grundy value 1 if and only if either or is odd and .*

We omit the proof of the above proposition; it is simple and straightforward.

#### 5. Sprague-Grundy Values for Games with Three Piles

As we saw in Section 2, in End-Nim with three piles, a position is a -position if and only if it is symmetrical but not constant; that is, and . The -positions of misère-End-Nim comprise those of End-Nim, as well as . The -positions of Loop-End-Nim comprise those of End-Nim, as well as the constant positions , with . For the positions of Sprague-Grundy value 1, we have the following three results.

Theorem 5.1. *In End-Nim, a position with has Sprague-Grundy value 1 if and only if one of the following three conditions holds*(a)*,*(b)* and either(i) is even and or(ii) is odd and and ,*(c)

*and is odd and .*

Theorem 5.2. *In misère-End-Nim, a position with has Sprague-Grundy value 1 if and only if one of the following three conditions holds*(a)(b)*,*(c)* and either(i) is even and or(ii) is odd and either or .*

Theorem 5.3. *In Loop-End-Nim, a position with has Sprague-Grundy value 1 if and only if one of the following two conditions holds*(a)* and either(i) is even and or(ii) is odd and .*(b)

*and is odd, .*

We provide a proof of Theorem 5.1 in the next section. The proof is simple and straightforward, but rather long. We omit the proofs of Theorems 5.2 and 5.3 which can be established in the same manner. We also provide the following result without proof. It shows that it is unlikely that there is a simple formula for the Sprague-Grundy function for End-Nim.

Theorem 5.4. *In End-Nim, a position with has Sprague-Grundy value 2 if and only if one of the following conditions holds, where the congruences are all modulo 4:*(a)*,*(b)* and either(i)(ii) or(iii) is odd, , except for where .*(c)

*and either(i)*(d)

*and if then , or*(ii)*and either(I)*(iii)*,*(II)*, or*(III)*and if then ,**and either or .**, and .*

#### 6. Proof of Theorem 5.1

We say that a position is a *1-position* if it has the form with Sprague-Grundy value 1, or the form verifying condition (a), (b), or (c) of Theorem 5.1; in the latter case we say is of type (a), (b), or (c), respectively. We must prove two properties:(1)there is no move from a 1-position to a 1-position,(2)from every position that is not a 0-position or a 1-position, there is a move to a 1-position.

To establish the first property, we suppose that is a 1-position. If has Sprague-Grundy value 1, and , then is even and . It follows that as is a 1-position, neither nor has Sprague-Grundy value 1. Indeed, if is a 1-position, then , and if , then is necessarily of type (b). But in this case, if is even, , while if is odd, , and both cases are impossible if has Sprague-Grundy value 1. Hence it suffices to consider moves . First suppose that is of type (c), that is, has the form , where is odd. There is obviously no move from to . So, since the 1-positions have , we need only consider the following moves:Firstly, is not a 1-position, since here is odd and . Secondly, is not a 1-position. Indeed, is even and . Thirdly, is not a 1-position, as here but .

Now suppose that is of type (b), that is has the form . We need only to consider the following moves: If is a 1-position, then it is of type (c) and so must be even and , contradicting the assumption that is a 1-position. Similarly, if is a 1-position, then it is of type (c) and so must be odd and , again contradicting the assumption that is a 1-position. If is a 1-position, then it is of type (b) and either is odd and or is even and , and both cases contradict the assumption that is a 1-position. If is a 1-position, then it is of type (a) and thus , but then , which is not a 1-position.

Finally, if is of type (a), then and there is only one move, to , which is a 0-position. This completes the proof of property 1.

To prove property 2, consider a position , with , that is not a 0-position or a 1-position. There are 7 cases to consider;(a),(b) and is even,(c) and is odd and ,(d) and is even and ,(e) and is odd and ,(f) and is odd and ,(g) and .

In each case, we must exhibit moves to 1-positions.

*Case (a). *We divide this further into subcases;(i)If is even and , consider the move .(ii)If is even and or , consider the move .(iii)If is even and , consider the move .(iv)If is odd and or , consider the move .(v)If is odd and , consider the move .(vi)If is odd and and , consider the move .(vii)If is odd and and , consider the move .(viii)If is odd and and , consider the move .(ix)If , consider the move .

*Case (b). *We have subcases;(i)If , consider the move .(ii)If or , consider the move .(iii)If , consider the move .

*Case (c). *We have subcases;(i)If or , consider the move .(ii)If and , consider the move .(iii)If and , consider the move .(iv)If and , consider the move .(v)If , consider the move .

*Case (d). *We have subcases;(i)If or , consider the move .(ii)If , consider the move .

*Case (e). *We have subcases;(i)If and , consider the move .(ii)If and , consider the move .(iii)If and , consider the move .(iv)If , consider the move .

*Case (f). *Consider the move .

*Case (g). *We have subcases;(i)If is odd, consider the move .(ii)If is even, consider the move .

#### References

- E. R. Berlekamp, J. H. Conway, and R. K. Guy,
*Winning Ways for Your Mathematical Plays. Vol. 1*, A K Peters Ltd., Natick, Mass, USA, 2nd edition, 2001. - M. H. Albert and R. J. Nowakowski, “The game of End-Nim,”
*Electronic Journal of Combinatorics*, vol. 8, no. 2, p. 12, 2001, In honor of Aviezri Fraenkel on the occasion of his 70th birthday. View at Zentralblatt MATH - R. K. Guy, “Unsolved problems in combinatorial games,” in
*Games of No Chance (Berkeley, CA, 1994)*, vol. 29 of*Publications of the Research Institute for Mathematical Sciences*, pp. 475–491, Cambridge University Press, Cambridge, UK, 1996. - T. E. Plambeck and A. N. Siegel, “Misère quotients for impartial games,”
*Journal of Combinatorial Theory Series A*, vol. 115, no. 4, pp. 593–622, 2008. View at Zentralblatt MATH - G. Cairns, N. B. Ho, and T. Lengyel, “The Sprague-Gundy function of the real game Euclid,”
*Discrete Mathematics*, vol. 311, no. 6, pp. 457–462, 2011. View at Publisher · View at Google Scholar