#### Abstract

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 [1], 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 [2] 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 [3–9]. Some restrictions of Grossman’s game can be found in [10–12]. The misère version of Grossman’s game was studied in [13].

Collins and Lengyel [11] 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 , where , there are three types of moves in 3-Euclid: (i) 1-2 moves: subtracting a multiple of from ; (ii) 1–3 moves: subtracting a multiple of from ; (iii) 2-3 moves: subtracting a multiple of from .

In this paper, we present two restrictions of Collins and Lengyel’s game. In the first restriction that we call , 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 , 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 is a restriction of the game 3-Euclid allowing the 1-2 and 1–3 moves while the game 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 and .

Recall that a position is said to be an *-position* (we write ) if the next player to move from has a strategy to win. Otherwise, is said to be a *-position* (we write ). 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 is denoted by . Not surprisingly, the Sprague-Grundy functions for 3-Euclid, , and are pairwise distinct. For example, calculations show that for the position the Sprague-Grundy value is 1 for 3-Euclid, 2 for , and 3 for . The -positions of 3-Euclid also differ to those of and . For example, is a -position in 3-Euclid, but it has Sprague-Grundy value 1 for and . Curiously, and 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 and 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 and 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 satisfying the condition for some given . This is analogous to a result of Collins and Lengyel [11]. Section 5 examines the misère versions of the two games and . 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 [14], 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 -Positions

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

Lemma 2.1. *Let . In the game , if then .*

* Proof. *Assume by contradiction that there exists a -position with and . Then . There must be a move from to some -position . As , the position must be of the form for some . This is a contradiction as there is then a move from to .

Theorem 2.2. *The -positions in the game are identical to those in the game .*

* Proof. *Let be the sets of -positions and -positions, respectively, of the game . We prove that the following two properties hold for the game :(i)every move from a position in terminates in ;(ii)from every position in , there exists a move that terminates in .Since every move in is legal in , (ii) holds. Assume by contradiction that (i) does not hold for . Then there exists a position with and a move in leading to some position in . This move cannot be a 1–3 move as (i) holds for , and so this move must be a 1-2 move. Therefore, there exists such that . By Lemma 2.1, giving a contradiction. Therefore, (i) holds for .

Lemma 2.3. *Let . For the two games and , there exists exactly one integer in each residue class such that .*

* Proof. *We will prove the existence for the game and the uniqueness for the game . The lemma then follows Theorem 2.2. For the existence, let be an integer such that and . Consider the position in the game . If then we are done. If then there exists a move from to some -position . This move must be a 1–3 move, and so is of the form as required. For the uniqueness, assume by contradiction that there are two positive integers in the residue class such that both and are -positions in the game . Since are in the same residue class , we have . If then there exists a 1-2 move from to . This is a contradiction. If then there exists a 1–3 move from to . 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 . Then if and only if .*

* Proof. *By Theorem 2.2, it is enough to prove that the theorem holds for . For the necessary condition, let , let , the integer part of , and let denote the remainder, . Note that by Lemma 2.1. By Lemma 2.3, there is exactly one integer such that . We show that . First assume that . We have . However, as , by Lemma 2.1, giving a contradiction. Next, assume that and so . Note that by Lemma 2.1 and so . Consider the position . Since there exists a move from to , we have and so for some positive integer . By Lemma 2.1, we have which implies , as , and so . Note that and so there is a move from to which is also a -position. This is a contradiction.

Conversely, assume that . By Lemma 2.1, we have or . Since there exists a 1–3 move from to , we have . Then there exists a move from to some -position . Since , must be of the form for some . By Lemma 2.1, we have , and so . Therefore, .

Collins and Lengyel [11] suggested a similar result for the game 3-Euclid. They claimed that in the game 3-Euclid, if then if and only if . 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 . Then .*

*Proof. *By Theorem 2.2, it is enough to prove that in .

Assume by contradiction that . Then there exists a positive integer such that . By Lemma 2.1, giving a contradiction. Therefore, .

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

Proposition 2.6. *(i) Let . Then if and only if .**(ii) Let . Then if and only if .*

#### 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 before showing that the two games and 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 . In the game , if then .*

*Proof. *Assume by contradiction that . Then , and so there exists a move from to some position of Sprague-Grundy value 1. If , must be of the form for some . This is a contradiction as there exists a move from to . Therefore, . Moreover, since , there exists a move from to some -position . So must be of the form for some . Since , we have , and so . However, by Lemma 2.1, giving a contradiction. Therefore, .

Lemma 3.2. *Let . In the game , if then .*

*Proof. *This is immediate from Lemmas 2.1 and 3.1.

Lemma 3.3. *Let . In the game ,*(i)*if then ;*(ii)*if then .*

*Proof. *The proof is by induction on . One can check by hand that the lemma is true for . Assume that the lemma is true for for some , we will show that the lemma is true for . Note that if then the lemma is true by Corollary 2.5. Therefore, it is sufficient to prove the lemma for .

For (i), assume by contradiction that there exist such that and . By Lemma 2.1, we have and so . By Lemma 3.1, we have . Since , we have . As , by Lemma 3.2, we have . Consider the position . We have . Note that . By the inductive hypothesis on (ii), we have . Note that there exists a move from whose Sprague-Grundy value is 1 to and so . Also note that there exists a move from to and so , giving a contradiction. Thus, (i) is true for .

For (ii), assume by contradiction that there exist such that , and . Then there exist integers such that and . Since , by Lemma 2.1, . Note that and so . This also implies that . We claim that . Assume by contradiction that . Then . If , since , by Lemma 3.2, . However, also implies giving a contradiction. If , since , by Lemma 3.2, giving a contradiction. Therefore, . Note that . Now consider the position . Since and , by the inductive hypothesis on (i), we have giving a contradiction. Therefore, (ii) is true for .

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

*Question 1. *Let be positive integers. What is the relationship between so that ?

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

Corollary 3.4. *Let . In the game , if then .*

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

Theorem 3.5. *The positions of Sprague-Grundy value 1 in the game are identical to those in the game .*

*Proof. *Let be the set of positions of Sprague-Grundy value 1 in the game . We show that the following two properties hold for :(i)there is no move from a position in to a position in ,(ii)from every position that is not in , there is a move to a position in .Note that every move in is also legal in and so (ii) holds for G_{1}. Assume by contradiction that (i) does not hold for . Then, there exist a position with and a 1-2 move from to some position . This implies that for some . By Corollary 3.4, we have implying . But if then, by Corollary 2.5, 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 . For the two games and , if then and .*

* Proof. *We work with the game . By Lemma 3.1 and Theorem 3.5, . So it remains to show that . Note that by Corollary 3.4. Assume by contradiction that . Then there exists a move from to some -position . So must be of the form for some . Since , we must have , and so . But as , by Lemma 2.1, we have giving a contradiction. Therefore, .

The following corollary is the converse of Corollary 3.6 when .

Corollary 3.7. *Let . If , then and .*

* Proof. *By Lemma 2.1, we have . We first prove that . Assume by contradiction that . Then . By Lemma 3.3, giving a contradiction. Therefore, .

We now prove that . Assume by contradiction that . Then . There exists a move from to some position of Sprague-Grundy value 1. So, working in , must be of the form for some . Since , we have and so . But by Lemma 3.3, giving a contradiction. Therefore, .

Note that Corollary 3.7 does not hold for . For example, for , we have for both games but for the game and for the game . For , we have for both games but for the game and for the game . An answer for Question 1 would also provide a criteria for the case to hold in Corollary 3.7.

We now present two theorems giving periodicity of positions of Sprague-Grundy value 1 of the forms with and of the form .

Theorem 3.8. *Let and . Then if and only if .*

*Proof. *Assume that . By Corollary 3.6, we have . By Corollary 3.7, we have . Now assume that . By Corollary 3.6, we have . By Corollary 3.7, we have .

The previous theorem does not hold for . For example, , but for the game . Nevertheless, one has the following.

Theorem 3.9. *Let . Then if and only if .*

* Proof. *It is sufficient to prove that the theorem holds for the game . We first prove the necessary condition. Assume by contradiction that . By Lemma 2.1, . Then, and so there exists a move from to some position of Sprague-Grundy value 1. So must be of the form for some . We claim that . By Corollary 2.5, , so . If , then and so by Lemma 3.3. So . But this is impossible as there exists a move from to the position . Therefore, .

Conversely, assume that . Then . Note that by Corollary 2.5. Since there exists a move from to , . It follows that there exists a move from to some position of Sprague-Grundy value 1. So must be of the form for some . We claim that . Note that as . If then , and so, by Lemma 3.3, we have giving a contradiction. Hence and .

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

Corollary 3.10. * if and only if is odd.*

Proposition 3.11. *(i) Let . Then if and only if .**(ii) Let . Then if and only if .*

*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 . It can be checked that (i) holds for . Assume that (i) holds for for some . We now show that (i) holds for . If then by Corollary 2.5. Therefore, (i) holds for . We claim that (i) also holds for . Note that by Corollary 2.5 and the only move from is to . Therefore, by definition. Also note that . Therefore, (i) holds for . Let . We show that if and only if .

Suppose that . By Corollary 3.6, . We compare with . We claim that . In fact, if then by Corollary 2.5, but there exists a move from to . This is impossible. Hence . If , then by Corollary 3.7. Since , the inductive hypothesis gives , and so . If , then by Corollary 3.7; that is, . Since and , the inductive hypothesis gives and so .

Conversely, suppose that . Assume by contradiction that . Then by Lemma 3.3. By Corollary 3.7, we have . We compare with . Note that as . If , then by Corollary 3.6. As , by the inductive hypothesis, giving a contradiction. If , then by Corollary 3.6; that is, . Since and , by the inductive hypothesis, , and so giving a contradiction. Therefore, .

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

*Proof of Proposition 2.6. *For , Proposition 2.6 follows immediately from Proposition 3.11 and Lemma 3.3. For , 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 , and let be a nonnegative integer. We answer the question as to whether there exists a positive integer such that and whether such an existence is unique.

Theorem 4.1. *Let , and let be a nonnegative integer. For the game , there exists exactly one integer in each residue class such that .*

*Proof. *The result holds for by Lemma 2.3. So we may assume that .

For the uniqueness, assume by contradiction that there are two positive integers in the residue class such that . Since are in the same residue class modulo , we have . If then there exists a 1-2 move from to . This is a contradiction. If then there exists a 1–3 move from to . This is a contradiction. Therefore, the uniqueness holds.

For the existence, assume by contradiction that there is no integer in the residue class such that . Let and let be an integer such that and . Let . There are two cases for .

If , we consider the sequence of positions

Note that each pair of these positions has distinct Sprague-Grundy values, and so there are at most positions having Sprague-Grundy values from 0 to . Consequently, there are, in that sequence, at least positions having Sprague-Grundy values more than . Assume that these positions are
From each position , there exists a move to some position of Sprague-Grundy value . This move must be a 1-2 move, and so must be of the form . Since there are at most values for (as ) while there are positions , there must be two distinct positions and having the same Sprague-Grundy value in which and . This is a contradiction as there is a 1–3 move (as ) from one of the two positions to the other.

If , we consider the sequence of positions

This sequence contains at least positions having Sprague-Grundy values greater than . Assume that these positions are
From each position , there exists a move to some position of Sprague-Grundy value . This move must be a 1-2 move and so must be of the form . Since there are at most values for while there are positions , there must be two distinct positions and having the same Sprague-Grundy value in which and . If then there exists a 1–3 move from one of two positions to the other. This is a contradiction. Therefore, and so , and the two integers and are in the same residue class . Thus, there are two distinct integers in the residue class satisfying . This contradicts the uniqueness part of the theorem. Therefore, the existence holds.

Theorem 4.2. *Let , and let be a nonnegative integer. For the game , in each residue class , there exists at least one integer such that .*

*Proof. *By Lemma 2.3, we may assume that . Let be an integer such that and . Consider the sequence of positions
Note that each pair of these positions has distinct Sprague-Grundy values and so there are at most positions having Sprague-Grundy values from 0 to . Therefore, if none of these positions has Sprague-Grundy value then there exists at least one of these positions having Sprague-Grundy value more than , say . Then there exists a 1–3 move from to some position of Sprague-Grundy value , as required.

In Theorem 4.2, the existence of is not unique. For example, the three positions , and have the same Sprague-Grundy value 4. Whenever the existence of the value is not unique, we have the following observation on the values for the game . We have checked this result as far as .

*Observation 1. *Let . In the game , if there are two values in the same residue class modulo such that then , and are both multiples of .

#### 5. Miserability

In this section, we examine the misère versions of two games and . 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 to if and only if there is a move from the position to the position . 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 be an impartial game and the corresponding digraph of the game . The misère version of the game can be considered as the graph obtained from by adding an extra vertex and a move from the sink of to [13]. In [14], 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 of -positions and of positions of Sprague-Grundy value 1 so that the two functions and swap on positions in and and are equal on other positions. Here and are the Sprague-Grundy functions for the game and its misère version respectively. If is equal to the set of -positions and 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 and 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 . In the misère versions,*(i)*if then ;*(ii)*if then .*

Theorem 5.2. *The -positions of the misère version of are identical to those of the misère version of .*

Theorem 5.3. *The positions of Sprague-Grundy value 1 in the misère version of are identical to those in the misère version of .*

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

Theorem 5.4. *Let such that . In the misère versions of and , if then .*

Theorem 5.5. *Let such that and . In the misère versions of and , if has Sprague-Grundy value 1 then has Sprague-Grundy value 1.*

Theorem 5.6. *Let . In the misère versions of and , if has Sprague-Grundy value 1 then 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 by Theorems 5.2 and 5.3.

Theorem 5.7. *The game is miserable.*

* Proof. *Consider the graph with the sink of the misère version. For each vertex (position) , the *height * of is the length of the longest directed path from to the sink . We will prove by induction on that if either or then . Note that the claim is true for . Assume that the claim is true for for some . We show that the claim is true for .

We first assume that . For each , there exists such that and one can move from to . By the inductive hypothesis, , and if there is a move from to some with then . It remains to show that . We show that there is a move between in the misère version of . Assume that . There are three following possibilities for moves from to :

(i);(ii);(iii)either or . One can check that there is a move between for the first two possibilities. We show that the third possibility does not occur. In fact, consider the assumption (the other case can be treated similarly). By Lemma 5.1, we have , and so . Note that by Lemma 5.1 and so . Consequently, giving a contradiction. Hence, . Similarly, we can show that if then . This completes the proof.

Note that the game (and so ) is not strongly miserable. A counterexample is the position (1, 3, 3) which is a -position in 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.