IJCTInternational Journal of Combinatorics1687-91711687-9163Hindawi Publishing Corporation40625010.1155/2012/406250406250Research ArticleVariations of the Game 3-EuclidHoNhan BaoMansourToufikDepartment of MathematicsLa Trobe UniversityMelbourne, VIC 3086Australialatrobe.edu.au201262201220123011201127122011050120122012Copyright © 2012 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.

We present two variations of the game 3-Euclid. The games involve a triplet of positive integers. Two players move alternately. In the first game, each move is to subtract a positive integer multiple of the smallest integer from one of the other integers as long as the result remains positive. In the second game, each move is to subtract a positive integer multiple of the smallest integer from the largest integer as long as the result remains positive. The player who makes the last move wins. We show that the two games have the same 𝒫-positions and positions of Sprague-Grundy value 1. We present three theorems on the periodicity of 𝒫-positions and positions of Sprague-Grundy value 1. We also obtain a theorem on the partition of Sprague-Grundy values for each game. In addition, we examine the misère versions of the two games and show that the Sprague-Grundy functions of each game and its misère version differ slightly.

1. Introduction

The game Euclid, introduced by Cole and Davie , is a two-player game based on the Euclidean algorithm. A position in Euclid is a pair of positive integers. The two players move alternately. Each move is to subtract from one of the entries a positive integer multiple of the other without making the result negative. The game stops when one of the entries is reduced to zero. The player who makes the last move wins. In the literature, the term Euclid has been also used for a variation presented by Grossman  in which the game stops when the two entries are equal. More details and discussions on Euclid and Grossman’s game can be found in . Some restrictions of Grossman’s game can be found in . The misère version of Grossman’s game was studied in .

Collins and Lengyel  presented an extension of Grossman’s game to three dimensions that they called 3-Euclid. In 3-Euclid, a position is a triplet of positive integers. Each move is to subtract from one of the integers a positive integer multiple of one of the others as long as the result remains positive. Generally, from a position (a,b,c), where abc, there are three types of moves in 3-Euclid: (i) 1-2 moves: subtracting a multiple of a from b; (ii) 1–3 moves: subtracting a multiple of a from c; (iii) 2-3 moves: subtracting a multiple of b from c.

In this paper, we present two restrictions of Collins and Lengyel’s game. In the first restriction that we call G1, a move is to subtract a positive integer multiple of the smallest integer from one of the other integers as long as the result remains positive. In the second restriction that we call G2, each move is to subtract a positive integer multiple of the smallest integer from the largest integer as long as the result remains positive. The two games therefore stop when the three integers are equal. Thus, the game G1 is a restriction of the game 3-Euclid allowing the 1-2 and 1–3 moves while the game G2 is a restriction of 3-Euclid allowing only the 1–3 move. We investigate 𝒫-positions and positions of Sprague-Grundy value 1 of the two games G1 and G2.

Recall that a position p is said to be an 𝒩-position (we write p𝒩) if the next player to move from p has a strategy to win. Otherwise, p is said to be a 𝒫-position (we write p𝒫). Note that every move from a 𝒫-position terminates at some 𝒩-position while from an 𝒩-position, there exists a move terminating at some 𝒫-position.

Throughout this paper, the Sprague-Grundy value of the position p is denoted by 𝒢(p). Not surprisingly, the Sprague-Grundy functions for 3-Euclid, G1, and G2 are pairwise distinct. For example, calculations show that for the position (2,3,7) the Sprague-Grundy value is 1 for 3-Euclid, 2 for G1, and 3 for G2. The 𝒫-positions of 3-Euclid also differ to those of G1 and G2. For example, (3,6,7) is a 𝒫-position in 3-Euclid, but it has Sprague-Grundy value 1 for G1 and G2. Curiously, G1 and G2 have the same 𝒫-positions and the same positions of Sprague-Grundy value 1. This is the main result in this paper.

This paper is organized as follows. In Section 2, we show that the two games G1 and G2 have the same 𝒫-positions before proving a periodicity result for the 𝒫-positions. We also give some classes of 𝒫-positions of the two games. In Section 3, we show that the two games G1 and G2 also have the same positions of Sprague-Grundy value 1 and then present some connections between positions of Sprague-Grundy value 1 and 𝒫-positions. We give two theorems on the periodicity of the positions of Sprague-Grundy value 1. Some special cases of positions of Sprague-Grundy value 1 are also discussed. Section 4 discusses the existence of values c satisfying the condition 𝒢(a,b,c)=s for some given a,b,s. This is analogous to a result of Collins and Lengyel . Section 5 examines the misère versions of the two games G1 and G2. It will be shown that these two games and their misère versions differ slightly only on a subset of positions of Sprague-Grundy values 0 and 1. This result also shows that, as established in , the miserability is quite common in impartial games.

This paper continues our investigations of variants of Euclid and related questions; see [3, 15, 16].

2. On the <inline-formula><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" id="M59"><mml:mrow><mml:mi>𝒫</mml:mi></mml:mrow></mml:math></inline-formula>-Positions

We show in this section that the two games G1 and G2 have the same 𝒫-positions. We then present a periodicity property of 𝒫-positions and some special classes of 𝒫-positions.

Lemma 2.1.

Let abc. In the game G2, if (a,b,c)𝒫 then c<a+b.

Proof.

Assume by contradiction that there exists a 𝒫-position (a,b,c) with abc and ca+b. Then (a,b,c-a)𝒩. There must be a move from (a,b,c-a) to some 𝒫-position p. As c-ab, the position p must be of the form (a,b,c-a-ia) for some i1. This is a contradiction as there is then a move from (a,b,c) to p.

Theorem 2.2.

The 𝒫-positions in the game G2 are identical to those in the game G1.

Proof.

Let A,B be the sets of 𝒫-positions and 𝒩-positions, respectively, of the game G2. We prove that the following two properties hold for the game G1:

every move from a position in A terminates in B;

from every position in B, there exists a move that terminates in A.

Since every move in G2 is legal in G1, (ii) holds. Assume by contradiction that (i) does not hold for G1. Then there exists a position (a,b,c)A with abc and a move in G1 leading (a,b,c) to some position in A. This move cannot be a 1–3 move as (i) holds for G2, and so this move must be a 1-2 move. Therefore, there exists i1 such that (a,b-ia,c)A. By Lemma 2.1, c<a+b-iab giving a contradiction. Therefore, (i) holds for G1.

Lemma 2.3.

Let ab. For the two games G1 and G2, there exists exactly one integer c1 in each residue class r(moda) such that (a,b,c)𝒫.

Proof.

We will prove the existence for the game G2 and the uniqueness for the game G1. The lemma then follows Theorem 2.2. For the existence, let d be an integer such that abd and drmoda. Consider the position (a,b,d) in the game G2. If 𝒢(a,b,d)=0 then we are done. If 𝒢(a,b,d)>0 then there exists a move from (a,b,d) to some 𝒫-position p. This move must be a 1–3 move, and so p is of the form (a,b,d-ia) as required. For the uniqueness, assume by contradiction that there are two positive integers c1<c2 in the residue class r(mod  a) such that both (a,b,c1) and (a,b,c2) are 𝒫-positions in the game G1. Since c1,c2 are in the same residue class rmoda, we have c2>a. If c2<b then there exists a 1-2 move from (a,c2,b) to (a,c1,b). This is a contradiction. If c2b then there exists a 1–3 move from (a,b,c2) to (a,b,c1). This is a contradiction. Therefore, the uniqueness holds.

We now present a periodicity result for the 𝒫-positions. Note that the following theorem holds for both games by Theorem 2.2.

Theorem 2.4.

Let abc. Then (a,b,c)𝒫 if and only if (a,b+a,c+a)𝒫.

Proof.

By Theorem 2.2, it is enough to prove that the theorem holds for G2. For the necessary condition, let (a,b,c)𝒫, let m=b/a, the integer part of b/a, and let r denote the remainder, r=b-ma. Note that c<a+b by Lemma 2.1. By Lemma 2.3, there is exactly one integer n such that p=(a,na+r,c+a)𝒫. We show that n=m+1. First assume that nm. We have na+r+ama+r+a=b+ac+a. However, as p𝒫, by Lemma 2.1, a+na+r>c+a giving a contradiction. Next, assume that nm+2 and so na+rb+2a. Note that a+b>c by Lemma 2.1 and so na+r>c+a. Consider the position q=(a,b+a,c+a). Since there exists a move from p=(a,c+a,na+r) to q, we have q𝒩 and so (a,b+a,c+a-ja)𝒫 for some positive integer j. By Lemma 2.1, we have b+a<a+c+a-ja which implies j=1, as b+a>c, and so (a,b+a,c)𝒫. Note that b+a>c and so there is a move from (a,b+a,c) to (a,b,c) which is also a 𝒫-position. This is a contradiction.

Conversely, assume that (a,b+a,c+a)𝒫. By Lemma 2.1, we have c+a<a+b+a or c<a+b. Since there exists a 1–3 move from (a,b+a,c+a) to (a,c,b+a), we have (a,c,b+a)𝒩. Then there exists a move from (a,c,b+a) to some 𝒫-position p. Since b+a>c, p must be of the form (a,b+a-ja,c) for some j1. By Lemma 2.1, we have a+b+a-ja>c, and so j=1. Therefore, (a,b,c)𝒫.

Collins and Lengyel  suggested a similar result for the game 3-Euclid. They claimed that in the game 3-Euclid, if b,c>a2 then (a,b,c)𝒫 if and only if (a,b+a,c+a)𝒫. To our knowledge, a proof for this claim has not appeared in the literature. In our opinion, a proof for this claim would be much more complicated.

We now solve some special cases for 𝒫-positions.

Corollary 2.5.

Let ab. Then (a,b,b)𝒫.

Proof.

By Theorem 2.2, it is enough to prove that (a,b,b)𝒫 in G2.

Assume by contradiction that (a,b,b)𝒩. Then there exists a positive integer i such that (a,b-ia,b)𝒫. By Lemma 2.1, b<a+b-iab giving a contradiction. Therefore, (a,b,b)𝒫.

We state one further result, whose proof we postpone until the end of the next section.

Proposition 2.6.

(i)  Let 2ab. Then (a,b-1,b)𝒫 if and only if gcd(a,b)1.

(ii)  Let a<b. Then (a,b-a,b-1)𝒫 if and only if gcd(a,b)=1.

3. The Positions of Sprague-Grundy Value 1

In this section, we first give some basic results on the Sprague-Grundy function of the game G2 before showing that the two games G1 and G2 have the same set of positions of Sprague-Grundy value 1. We then show that there is a bridge between the set of 𝒫-positions and the set of positions of Sprague-Grundy value 1. Next, we present two theorems on the periodicity of positions of Sprague-Grundy value 1. Finally, we solve the Sprague-Grundy function for some special cases.

Lemma 3.1.

Let abc. In the game G2, if 𝒢(a,b,c)=1 then (a,b,c-a)𝒫.

Proof.

Assume by contradiction that (a,b,c-a)𝒫. Then 𝒢(a,b,c-a)>1, and so there exists a move from (a,b,c-a) to some position p of Sprague-Grundy value 1. If c-ab, p must be of the form (a,b,c-a-ia) for some i1. This is a contradiction as there exists a move from (a,b,c) to p. Therefore, c-a<b. Moreover, since 𝒢(a,b,c)=1, there exists a move from (a,b,c) to some 𝒫-position q. So q must be of the form (a,b,c-ia) for some i1. Since (a,b,c-a)𝒫, we have i2, and so a+c-iac-a<b. However, by Lemma 2.1, a+c-ia>b giving a contradiction. Therefore, (a,b,c-a)𝒫.

Lemma 3.2.

Let abc. In the game G2, if 𝒢(a,b,c)=1 then c<2a+b.

Proof.

This is immediate from Lemmas 2.1 and 3.1.

Lemma 3.3.

Let abc. In the game G2,

if c>a+b then 𝒢(a,b,c)2;

if c<a+b then 𝒢(a,b,c)1.

Proof.

The proof is by induction on c. One can check by hand that the lemma is true for c3. Assume that the lemma is true for cn for some n3, we will show that the lemma is true for c=n+1. Note that if b=c then the lemma is true by Corollary 2.5. Therefore, it is sufficient to prove the lemma for ab<c=n+1.

For (i), assume by contradiction that there exist ab such that a+b<c and 𝒢(a,b,c)1. By Lemma 2.1, we have 𝒢(a,b,c)0 and so 𝒢(a,b,c)=1. By Lemma 3.1, we have (a,b,c-a)𝒫. Since c>a+b, we have c-2a>0. As 𝒢(a,b,c)=1, by Lemma 3.2, we have c-2a<b. Consider the position (a,c-2a,b). We have a+c-2a=c-a>b. Note that bn. By the inductive hypothesis on (ii), we have 𝒢(a,c-2a,b)1. Note that there exists a move from (a,b,c) whose Sprague-Grundy value is 1 to (a,c-2a,b) and so 𝒢(a,c-2a,b)1. Also note that there exists a move from (a,b,c-a)𝒫 to (a,c-2a,b) and so 𝒢(a,c-2a,b)0, giving a contradiction. Thus, (i) is true for c=n+1.

For (ii), assume by contradiction that there exist a,b such that ab<c, c<a+b and 𝒢(a,b,c)2. Then there exist integers i,j1 such that 𝒢(a,b,c-ia)=0 and 𝒢(a,b,c-ja)=1. Since 𝒢(a,b,c-ia)=0, by Lemma 2.1, a+c-ia>b. Note that c-a<b and so i=1. This also implies that j2. We claim that j=2. Assume by contradiction that j3. Then 2a+c-jac-a<b. If c-ja<a, since 𝒢(c-ja,a,b)=1, by Lemma 3.2, 2(c-ja)+a>b. However, c-ja<a also implies 2(c-ja)+a<2a+c-ja giving a contradiction. If ac-ja, since 𝒢(a,c-ja,b)=1, by Lemma 3.2, 2a+c-ja>b giving a contradiction. Therefore, j=2. Note that c-2a<b. Now consider the position (a,c-2a,b). Since a+c-2a=c-a<b and b<n+1, by the inductive hypothesis on (i), we have 𝒢(a,c-2a,b)2 giving a contradiction. Therefore, (ii) is true for c=n+1.

Thus, by the inductive principle, the lemma is true.

Question 1.

Let ab be positive integers. What is the relationship between a,b so that 𝒢(a,b,a+b)=1?

By the part (i) of Lemma 3.3, we have a result stronger than Lemma 3.2 as follows.

Corollary 3.4.

Let abc. In the game G2, if 𝒢(a,b,c)=1 then ca+b.

We are now in the position to show that all results early in this section are also true for the game G1.

Theorem 3.5.

The positions of Sprague-Grundy value 1 in the game G2 are identical to those in the game G1.

Proof.

Let A be the set of positions of Sprague-Grundy value 1 in the game G2. We show that the following two properties hold for G1:

there is no move from a position in A to a position in A,

from every position that is not in 𝒫A, there is a move to a position in A.

Note that every move in G2 is also legal in G1 and so (ii) holds for G1. Assume by contradiction that (i) does not hold for G1. Then, there exist a position p=(a,b,c)A with abc and a 1-2 move from p to some position qA. This implies that q=(a,b-ia,c) for some i1. By Corollary 3.4, we have ca+b-iab implying c=b. But if c=b then, by Corollary 2.5, (a,b,c)𝒫 giving a contradiction. Therefore (i) holds.

In the next part, we find some connections between the 𝒫-positions and the set of positions of Sprague-Grundy value 1.

Corollary 3.6.

Let abc. For the two games G1 and G2, if 𝒢(a,b,c)=1 then (a,b,c-a)𝒫 and (a,c,b+a)𝒫.

Proof.

We work with the game G2. By Lemma 3.1 and Theorem 3.5, (a,b,c-a)𝒫. So it remains to show that (a,c,b+a)𝒫. Note that ca+b by Corollary 3.4. Assume by contradiction that (a,c,b+a)𝒫. Then there exists a move from (a,c,b+a) to some 𝒫-position p. So p must be of the form (a,c,b+a-ia) for some i1. Since 𝒢(a,b,c)=1, we must have i2, and so a+b+a-iabc. But as (a,c,b+a-ia)𝒫, by Lemma 2.1, we have a+b+a-ia>c giving a contradiction. Therefore, (a,c,b+a)𝒫.

The following corollary is the converse of Corollary 3.6 when b<c.

Corollary 3.7.

Let ab<c. If (a,b,c)𝒫, then 𝒢(a,c-a,b)=1 and 𝒢(a,c,b+a)=1.

Proof.

By Lemma 2.1, we have a+b>c. We first prove that 𝒢(a,c-a,b)=1. Assume by contradiction that 𝒢(a,c-a,b)1. Then 𝒢(a,c-a,b)>1. By Lemma 3.3, ba+c-a=c giving a contradiction. Therefore, 𝒢(a,c-a,b)=1.

We now prove that 𝒢(a,c,b+a)=1. Assume by contradiction that 𝒢(a,c,b+a)1. Then 𝒢(a,c,b+a)>1. There exists a move from (a,c,b+a) to some position p of Sprague-Grundy value 1. So, working in G2, p must be of the form (a,c,b+a-ia) for some i1. Since p(a,b,c), we have i2 and so a+b+a-iab<c. But by Lemma 3.3, 𝒢(a,c,b+a-ia)2 giving a contradiction. Therefore, 𝒢(a,c,b+a)=1.

Note that Corollary 3.7 does not hold for b=c. For example, for a=1,b=3, we have 𝒢(a,b,b)=0 for both games but 𝒢(a,b-a,b)=3 for the game G1 and 𝒢(a,b-a,b)=2 for the game G2. For a=1,b=2, we have 𝒢(a,b,b)=0 for both games but 𝒢(a,b,b+a)=3 for the game G1 and 𝒢(a,b,b+a)=2 for the game G2. An answer for Question 1 would also provide a criteria for the case b=c to hold in Corollary 3.7.

We now present two theorems giving periodicity of positions of Sprague-Grundy value 1 of the forms (a,b,c) with a+b>c and of the form (a,b,a+b).

Theorem 3.8.

Let abc and a+b>c. Then 𝒢(a,b,c)=1 if and only if 𝒢(a,b+a,c+a)=1.

Proof.

Assume that 𝒢(a,b,c)=1. By Corollary 3.6, we have (a,c,b+a)𝒫. By Corollary 3.7, we have 𝒢(a,b+a,c+a)=1. Now assume that 𝒢(a,b+a,c+a)=1. By Corollary 3.6, we have (a,c,b+a)𝒫. By Corollary 3.7, we have 𝒢(a,b,c)=1.

The previous theorem does not hold for c=a+b. For example, 𝒢(1,3,4)=1, but 𝒢(1,4,5)=2 for the game G2. Nevertheless, one has the following.

Theorem 3.9.

Let ab. Then 𝒢(a,b,a+b)=1 if and only if 𝒢(a,b+2a,b+3a)=1.

Proof.

It is sufficient to prove that the theorem holds for the game G2. We first prove the necessary condition. Assume by contradiction that 𝒢(a,b+2a,b+3a)1. By Lemma 2.1, 𝒢(a,b+2a,b+3a)0. Then, 𝒢(a,b+2a,b+3a)2 and so there exists a move from (a,b+2a,b+3a) to some position p of Sprague-Grundy value 1. So p must be of the form (a,b+2a,b+3a-ia) for some i1. We claim that i=2. By Corollary 2.5, (a,b+2a,b+2a)𝒫, so i1. If i3, then a+b+3a-iab+a<b+2a and so 𝒢(a,b+2a,b+3a-ia)2 by Lemma 3.3. So i=2. But this is impossible as there exists a move from p to the position (a,b,a+b). Therefore, 𝒢(a,b+2a,b+3a)=1.

Conversely, assume that 𝒢(a,b+2a,b+3a)=1. Then 𝒢(a,b+a,b+2a)1. Note that (a,b+a,b+a)𝒫 by Corollary 2.5. Since there exists a move from (a,b+a,b+2a) to (a,b+a,b+a), 𝒢(a,b+a,b+2a)2. It follows that there exists a move from (a,b+a,b+2a) to some position q of Sprague-Grundy value 1. So q must be of the form (a,b+a,b+2a-ia) for some i1. We claim that i=2. Note that i1 as (a,b+a,b+a)𝒫. If i3 then a+b+2a-iab<b+a, and so, by Lemma 3.3, we have 𝒢(q)2 giving a contradiction. Hence i=2 and 𝒢(a,b,b+a)=1.

We now present some special classes of positions of Sprague-Grundy value 1. The following corollary follows from the above theorem by induction on a.

Corollary 3.10.

𝒢(1,a,a+1)=1 if and only if a is odd.

Proposition 3.11.

(i) Let 2ab. Then 𝒢(a,b-1,b)=1 if and only if gcd(a,b)=1.

(ii) Let 2a<b. Then 𝒢(a,b-a,b-1)=1 if and only if gcd(a,b)1.

Proof.

Note that (ii) follows from (i) by Corollary 3.6 and Lemma 3.3. Therefore, it is sufficient to prove (i). We prove (i) by induction on b. It can be checked that (i) holds for b=2,3. Assume that (i) holds for bn for some n3. We now show that (i) holds for b=n+1. If a=b then 𝒢(a,b-1,b)=0 by Corollary 2.5. Therefore, (i) holds for a=b. We claim that (i) also holds for a=b-1. Note that 𝒢(1,a,a)=0 by Corollary 2.5 and the only move from (a,a,a+1) is to (1,a,a). Therefore, 𝒢(a,a,a+1)=1 by definition. Also note that gcd(a,a+1)=1. Therefore, (i) holds for a=b-1. Let 2ab-2. We show that 𝒢(a,b-1,b)=1 if and only if gcd(a,b)=1.

Suppose that 𝒢(a,b-1,b)=1. By Corollary 3.6, 𝒢(a,b-a,b-1)=0. We compare a with b-a. We claim that ab-a. In fact, if a=b-a then 𝒢(b-1-a,a,b-a)=0 by Corollary 2.5, but there exists a move from (a,b-a,b-1) to (b-1-a,a,b-a). This is impossible. Hence ab-a. If a<b-a, then 𝒢(a,b-1-a,b-a)=1 by Corollary 3.7. Since b-a<n, the inductive hypothesis gives gcd(a,b-a)=1, and so gcd(a,b)=1. If b-a<a, then 𝒢(b-a,a,b-1-(b-a))=1 by Corollary 3.7; that is, 𝒢(b-a,a-1,a)=1. Since a<n and b-a2, the inductive hypothesis gives gcd(b-a,a)=1 and so gcd(a,b)=1.

Conversely, suppose that gcd(a,b)=1. Assume by contradiction that 𝒢(a,b-1,b)1. Then 𝒢(a,b-1,b)=0 by Lemma 3.3. By Corollary 3.7, we have 𝒢(a,b-a,b-1)=1. We compare a with b-a. Note that ab-a as gcd(a,b)=1. If a<b-a, then 𝒢(a,b-1-a,b-a)=0 by Corollary 3.6. As b-a<n, by the inductive hypothesis, gcd(a,b-a)1 giving a contradiction. If b-a<a, then 𝒢(b-a,a,b-1-(b-a))=0 by Corollary 3.6; that is, 𝒢(b-a,a-1,a)=0. Since a<n and b-a2, by the inductive hypothesis, gcd(b-a,a)1, and so gcd(a,b)1 giving a contradiction. Therefore, 𝒢(a,b-1,b)=1.

As promised at the end of the previous section, we now give the following.

Proof of Proposition <xref ref-type="statement" rid="prop1">2.6</xref>.

For a2, Proposition 2.6 follows immediately from Proposition 3.11 and Lemma 3.3. For a=1, Proposition 2.6(ii) follows from Corollary 2.5.

4. On the Partition of Sprague-Grundy Values

This section extends a result from Collins and Lengyel’s work on the game 3-Euclid. Let ab, and let s be a nonnegative integer. We answer the question as to whether there exists a positive integer c such that 𝒢(a,b,c)=s and whether such an existence is unique.

Theorem 4.1.

Let ab, and let s be a nonnegative integer. For the game G1, there exists exactly one integer c1 in each residue class r  (mod  a) such that 𝒢(a,b,c)=s.

Proof.

The result holds for s=0 by Lemma 2.3. So we may assume that s>0.

For the uniqueness, assume by contradiction that there are two positive integers c1<c2 in the residue class r  (mod  a) such that 𝒢(a,b,c1)=𝒢(a,b,c2). Since c1,c2 are in the same residue class modulo a, we have c2>a. If c2<b then there exists a 1-2 move from (a,c2,b) to (a,c1,b). This is a contradiction. If c2b then there exists a 1–3 move from (a,b,c2) to (a,b,c1). This is a contradiction. Therefore, the uniqueness holds.

For the existence, assume by contradiction that there is no integer c in the residue class r  (mod  a) such that 𝒢(a,b,c)=s. Let m=b/a and let d be an integer such that db and dr  (mod  a). Let b0=b-ma. There are two cases for b0.

If b0=0, we consider the sequence of positions (a,b,d+a),(a,b,d+2a),,(a,b,d+(s+m)a).

Note that each pair of these s+m positions has distinct Sprague-Grundy values, and so there are at most s positions having Sprague-Grundy values from 0 to s-1. Consequently, there are, in that sequence, at least m positions having Sprague-Grundy values more than s. Assume that these m positions are (a,b,d+i1a),(a,b,d+i2a),,(a,b,d+ima). From each position (a,b,d+ija), there exists a move to some position pj of Sprague-Grundy value s. This move must be a 1-2 move, and so pj must be of the form (a,b-kja,d+ija). Since there are at most m-1 values for kj (as b-kja>0) while there are m positions pj, there must be two distinct positions pj1=(a,b-kj1a,d+ij1a) and pj2=(a,b-kj2a,d+ij2a) having the same Sprague-Grundy value s in which kj1=kj2 and ij1ij2. This is a contradiction as there is a 1–3 move (as b-kjaa) from one of the two positions pj1,pj2 to the other.

If b0>0, we consider the sequence of positions (a,b,d+b0a),(a,b,d+2b0a),,(a,b,d+(s+m+1)b0a).

This sequence contains at least m+1 positions having Sprague-Grundy values greater than s. Assume that these m+1 positions are (a,b,d+i1b0a),(a,b,d+i2b0a),,(a,b,d+im+1b0a). From each position (a,b,d+ijb0a), there exists a move to some position qj of Sprague-Grundy value s. This move must be a 1-2 move and so qj must be of the form (a,b-kja,d+ijb0a). Since there are at most m values for kj while there are m+1 positions qj, there must be two distinct positions qj1=(a,b-kj1a,d+ij1b0a) and qj2=(a,b-kj2a,d+ij2b0a) having the same Sprague-Grundy value s in which kj1=kj2 and ij1ij2. If b-kj1aa then there exists a 1–3 move from one of two positions qj1,qj2 to the other. This is a contradiction. Therefore, b-kj1a<a and so b-kj1a=b0, and the two integers d+ij1b0a and d+ij2b0a are in the same residue class d(mod  b0). Thus, there are two distinct integers d+ij1b0a,d+ij2b0a in the residue class d(modb0) satisfying 𝒢(b0,a,d+ij1b0a)=𝒢(b0,a,d+ij2b0a). This contradicts the uniqueness part of the theorem. Therefore, the existence holds.

Theorem 4.2.

Let ab, and let s be a nonnegative integer. For the game G2, in each residue class r(moda), there exists at least one integer c1 such that 𝒢(a,b,c)=s.

Proof.

By Lemma 2.3, we may assume that s>0. Let d be an integer such that db and drmoda. Consider the sequence of positions (a,b,d),(a,b,d+a),(a,b,d+2a),,(a,b,d+sa). Note that each pair of these s+1 positions has distinct Sprague-Grundy values and so there are at most s positions having Sprague-Grundy values from 0 to s-1. Therefore, if none of these positions has Sprague-Grundy value s then there exists at least one of these positions having Sprague-Grundy value more than s, say (a,b,d+ia). Then there exists a 1–3 move from (a,b,d+ia) to some position 𝒢(a,b,d+(i-j)a) of Sprague-Grundy value s, as required.

In Theorem 4.2, the existence of c is not unique. For example, the three positions (4,4,19),(4,8,19), and (4,12,19) have the same Sprague-Grundy value 4. Whenever the existence of the value c is not unique, we have the following observation on the values c for the game G2. We have checked this result as far as b=100.

Observation 1.

Let ab. In the game G2, if there are two values c1,c2 in the same residue class modulo a such that 𝒢(a,b,c1)=𝒢(a,b,c2) then ac1,c2<b,b3a, and c1,c2 are both multiples of a.

5. Miserability

In this section, we examine the misère versions of two games G1 and G2. Recall that an impartial game is under misère convention if the player making the last move loses. A game can be described by a finite directed acyclic graph Γ without multiple edges in which each vertex is a position, and there is a downward edge from p to q if and only if there is a move from the position p to the position q. Moreover, the graph can be assumed to have only one source. A source is a vertex with no incoming edges. The source of the graph is the original position of the game. The sinks are the vertices with no outgoing edges, so the sinks of the graph are the final (terminal) positions of the game. For convenience, a graph of a game is assumed to have precisely one sink. This is because when the graph has more than one sink, they can be coalesced together into one sink without changing the properties of the game.

Let G be an impartial game and Γ the corresponding digraph of the game G. The misère version of the game G can be considered as the graph obtained from Γ by adding an extra vertex v0 and a move from the sink of Γ to v0 . In , a game is said to be miserable if its normal and misère versions are different only on some subset of positions of Sprague-Grundy values 0 and 1. More precisely, a game 𝒢 is miserable if there exist subsets V0 of 𝒫-positions and V1 of positions of Sprague-Grundy value 1 so that the two functions 𝒢 and 𝒢- swap on positions in V0 and V1 and are equal on other positions. Here 𝒢 and 𝒢- are the Sprague-Grundy functions for the game G and its misère version respectively. If V0 is equal to the set of 𝒫-positions and V1 is equal to the set of positions of Sprague-Grundy value 1 then the game is said to be strongly miserable. We will show that the two games G1 and G2 are miserable but not strongly miserable. Before presenting this result, let us discuss some properties of positions of Sprague-Grundy values 0 and 1 of the misère versions. The proofs for the following results are similar to those in previous sections.

Lemma 5.1.

Let abc. In the misère versions,

if c>a+b then 𝒢(a,b,c)2;

if c<a+b then 𝒢(a,b,c)1.

Theorem 5.2.

The 𝒫-positions of the misère version of G2 are identical to those of the misère version of G2.

Theorem 5.3.

The positions of Sprague-Grundy value 1 in the misère version of G2 are identical to those in the misère version of G1.

Some properties of periodicity of 𝒫-positions and positions of Sprague-Grundy value 1 of the two games G1 and G2 are still true for their misère versions.

Theorem 5.4.

Let abc such that (a,b,c)(a,a,2a). In the misère versions of G1 and G2, if (a,b,c)𝒫 then (a,b+a,c+a)𝒫.

Theorem 5.5.

Let abc such that a+b>c and (a,b,c)(a,2a,2a). In the misère versions of G1 and G2, if (a,b,c) has Sprague-Grundy value 1 then (a,b+a,c+a) has Sprague-Grundy value 1.

Theorem 5.6.

Let ab. In the misère versions of G1 and G2, if (a,b,a+b) has Sprague-Grundy value 1 then (a,b+2a,b+3a) has Sprague-Grundy value 1.

We now come back with the main result of this section. Note that the following theorem is also true for G2 by Theorems 5.2 and 5.3.

Theorem 5.7.

The game G1 is miserable.

Proof.

Consider the graph Γ1- with the sink v0 of the misère version. For each vertex (position) v, the height h(v) of v is the length of the longest directed path from v to the sink v0. We will prove by induction on h(v) that if either 𝒢1(v)2 or 𝒢1-(v)2 then 𝒢1-(v)=𝒢1(v). Note that the claim is true for h(v)=1. Assume that the claim is true for h(v)n for some n1. We show that the claim is true for h(v)=n+1.

We first assume that 𝒢1(v)2. For each k<𝒢1(v), there exists wk such that 𝒢1(wk)=k and one can move from v to wk. By the inductive hypothesis, 𝒢1-(w0),𝒢1-(w1)1, and if there is a move from v to some w with 𝒢1(w)2 then 𝒢1-(w)=𝒢1(w). It remains to show that 𝒢1-(w0)𝒢1-(w1). We show that there is a move between w0,w1 in the misère version of G1. Assume that v=(a,b,c). There are three following possibilities for moves from v to w0,w1:

w0=(a,b,c-ia),w1=(a,b,c-ja);

w0=(a,b-ia,c),w1=(a,b-ja,c);

either w0=(a,b,c-ia),w1=(a,b-ja,c) or w0=(a,b-ia,c),w1=(a,b,c-ja).

One can check that there is a move between w0,w1 for the first two possibilities. We show that the third possibility does not occur. In fact, consider the assumption w0=(a,b,c-ia),w1=(a,b-ja,c) (the other case can be treated similarly). By Lemma 5.1, we have a+b-jac, and so j=1,b=c. Note that a+c-iab by Lemma 5.1 and so i=1. Consequently, w0=w1 giving a contradiction. Hence, 𝒢1-(v)=𝒢1(v). Similarly, we can show that if 𝒢1-(v)2 then 𝒢1(v)=𝒢1-(v). This completes the proof.

Note that the game G1 (and so G2) is not strongly miserable. A counterexample is the position (1, 3, 3) which is a 𝒫-position in G1 and its misère version.

Acknowledgment

The author thanks the referee for his/her helpful comments and references. He thank his supervisor, Dr Grant Cairns, for careful reading of this paper.

ColeA. J.DavieA. J. T.A game based on the Euclidean algorithm and a winning strategy for itThe Mathematical Gazette196953354357025847210.2307/3612461ZBL0186.25303GrossmanJ. W.A nim-type game, problem #1537Mathematics Magazine199770382CairnsG.HoN. B.LengyelT.The Sprague-Gundy function of the real game EuclidDiscrete Mathematics2011311645746210.1016/j.disc.2010.12.0112799898FraenkelA. S.Euclid and Wythoff gamesDiscrete Mathematics20053041–3656810.1016/j.disc.2005.06.0222184445ZBL1079.91011HofmannS.SchusterG.SteudingJ.Euclid, Calkin & Wilf—playing with rationalsElemente der Mathematik200863310911710.4171/EM/952424893ZBL1193.91033LengyelT.On calculating the Sprague-Grundy function for the game Euclid194Proceedings of the 11th International Conference on Fibonacci Numbers and Their Applications2009Congressus Numerantium1671722463531NivaschG.The Sprague-Grundy function of the game EuclidDiscrete Mathematics2006306212798280010.1016/j.disc.2006.04.0202264378ZBL1201.91020SpitznagelE. L.Jr.Properties of a game based on Euclid's algorithmMathematics Magazine1973468792032155410.2307/2689037ZBL0268.90067StraffinP. D.A nim-type game, solution to problem #1537Mathematics Magazine199871394395CollinsD.Variations on a theme of EuclidIntegers200551122139166ZBL1121.91022CollinsD.LengyelT.The game of 3-EuclidDiscrete Mathematics200830871130113610.1016/j.disc.2007.03.0642382351ZBL1133.91010LengyelT.A nim-type game and continued fractionsThe Fibonacci Quarterly20034143103202022411ZBL1046.05500GurvichV. A.On the misere version of game Euclid and miserable gamesDiscrete Mathematics20073079-101199120410.1016/j.disc.2006.07.0422292548ZBL1108.91019GurvichV. A.Miserable and strongly miserable impartial gamesRUTCOR Research Report2011RRR-18CairnsG.HoN. B.A restriction of the game EuclidsubmittedCairnsG.HoN. B.Min, a combinatorial game having a connection with prime numbersIntegers20101076577010.1515/INTEG.2010.1032797778ZBL1203.91042