REGULARITY IN THE G−SEQUENCES OF OCTAL GAMES WITH A PASS

D. G. Horrocks^{1}

Department of Mathematics and Computer Science, University of Prince Edward Island, Charlottetown, PE C1A 4P3, Canada

                            dhorrocks@upei.ca

R. J. Nowakowski^{2}

Department of Mathematics and Statistics, Dalhousie University, Halifax, NS B3H 3J5, Canada

                           rjn@mathstat.dal.ca

Received: 9/19/02, Revised: 3/27/03, Accepted: 4/7/03, Published: 4/9/03

Abstract

Finite octal games are not arithmetic periodic. By adding a single pass move to precisely one heap, however, we show that arithmetic periodicity can occur. We also show a new regularity: games whose G−sequences are partially arithmetic periodic and partially periodic. We give a test to determine when an octal game with a pass has such regularity and as special cases when the G−sequence has become periodic or arithmetic periodic.

1. Introduction

A Taking-and-Breaking game (see Chapter 4 of [3]) is an impartial, combinatorial game, played with heaps of beans on a table. Players move alternately and a move for either player consists of choosing a heap, removing a certain number of beans from the heap and then possibly splitting the remainder into several heaps. The winner is the player making the last move. The number of beans to be removed and the number of heaps that one heap can be split into are given by the rules of the game. For a finite octal game the rules are given by the octal code d_{0}.d_{1}d_{2} … d_{u} where 0 ≤ d_{i} ≤ 7. If d_{i} = 0 then a player cannot take i beans away from a heap. If d_{i} = δ_{2}2^{2} + δ_{1}2^{1} + δ_{0}2^{0} where δ_{j} is 0 or 1, a player can remove i beans from the heap provided he leaves the remainder in exactly j non-empty heaps for some j with δ_{j} = 1. In such games, then, a heap cannot be split into more than 2 heaps. A subtraction game, in which a heap may be reduced only by one of the numbers in a prescribed set (called the subtraction set), has each d_{i} ∈ {0, 3}, i.e. a player can remove beans but cannot split the heap.

1partially supported by NSERC

2partially supported by NSERC

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 3 (2003), #G01 2

The followers, or options, of a game are all those positions which can be reached in one move. The minimum excluded value of a set S is the least nonnegative integer which is not included in S and is denoted mex(S). Note that mex{ } = 0. The nim-value of an impartial game G, denoted by G(G), is given by

G(G) = mex{G(H)|H is a follower of G}.

The values in the set {G(H)|H is a follower of G} are called excluded values for G(G). It is not difficult to see that an impartial game G is a previous player win, i.e. the next player has no good move, if and only if G(G) = 0.

The nim-sum of two nonnegative integers is the exclusive or (XOR), written ⊕, of their binary representations. It can also be described as adding the numbers in binary without carrying. A game G is the disjunctive sum of games H and K, written G = H + K, if on each turn, the players must choose one of H and K and make a legal move in that game. From the theory of impartial games (see [3] or [5]) if G = H + K, then G(G) = G(H) ⊕ G(K).

Taking-and-Breaking games are examples of disjunctive games – choose one heap and play in it. To know how to play these games well, it suffices to know what the nim-values are for individual heaps. For a given game, let G(i) be the nim-value of the game played with a heap of size i; the goal is to find a simple rule for G(i). We define the G-sequence for a Taking-and-Breaking game to be the sequence G(0), G(1), G(2), . . .. For a given subclass of these games, it is of interest to determine

What types of regularity are exhibited by the G−sequences?

A G−sequence is said to be periodic if there exist N and p such that G(n+p) = G(n) for all n ≥ N; it is arithmetic periodic if there exist N, p and s > 0 such that G(n+p) = G(n)+s for all n ≥ N, s is called the saltus.

All finite subtraction games have a bounded number of options and so are periodic.

Austin, [2] (see also [3]), shows that the G−sequence of any finite octal game cannot be arithmetic periodic. The heart of the proof is to show that there are too few options for the G−sequence to rise quickly enough for it to be arithmetic periodic. It is not known, however, if the G−sequence of a finite octal game must be periodic or even if the G−values are bounded.

Examples of games whose G−sequence is arithmetic periodic can be found amongst hexadecimal games. (That is, games in which the heaps can be split into three. The exact rules are generalizations of the octal rules but with d_{j} < 16.) For example, from [7], the G-sequence for 0.137F (F=15) is 0, 1, 1, 2, 2, 3, 3,…, where G(2m − 1) = G(2m) = m for m ≥ 1. In this case, the saltus is 1 and the period length is 2 or, in other words, G(n + 2) = G(n) + 1 for n ≥ 1. For hexadecimal games, another type of regularity is known to occur ([10]). The game 0.123456789 has the G−sequence 0, 1, 0, 2, 2, 1, 1, 3, 2, 4, 4, 5, 5, 6, 4 and thereafter

G(2m − 1) = G(2m) = m − 1, except G(2^{k} + 6) = 2^{k−1}.

The games 0.71790A96D9BD024 and 0.1234567B33B exhibit a similar regularity. Here A= 1, B= 2 etc.

For more results on subtraction games, see [1,3]; on octal and similar games see [3,4,8,9]; on hexadecimal games see [7,10]

Octal games with a pass move appeared when the first author investigated ‘Gale’s Subset-Take-Away’ game (see [6]). The sub-problem he considered was: Given a partial order known as a fence (or zig-zag see Figure 1), a move is to either take a top element, or a bottom element along with any elements above it.

[figure]

Figure 1: A fence

An alternative way to view this game is to consider the minimal elements as a heap. Suppose that the fence ends in two minimal elements. A move in the maximal elements removes 0 and splits the heap into 2 non-empty heaps. A move in the minimals removes 1 and there could be 0, 1 or 2 heaps left. Each move results in heaps with minimals at the ends and therefore the game is equivalent to the octal game 4.7 which has G−sequence 1, 2, 1, 2, 1, 2 . . .. Further, if the fence ends with one maximal element and one minimal element then a move in this game can never create another maximal element at the end of a fence and it is easy to show that for n ≥ 0,

G(3n + i) = \{ \begin{matrix}4n & i = 0, 2 \\ 4n + 2 & i = 1. \end{matrix}

where 3n + i indicates the number of minimals in a fence.

This G−sequence is arithmetic periodic, specifically, G(n + 3) = G(n) + 4.

With the translation to the heap game, we have the same moves as before, however, taking the end maximal translates into a pass move and taking the minimal below the end maximal eliminates the pass move. Finally, if the fence ends with two maximal elements then it is now easy to show that the G−sequence is 1, 1, 1, 1, . . ..

There are several immediate generalizations of this game but we concentrate on just one. A p-octal game is an octal game that has a pass move and the game is played according to the following rules. If the pass move has not been played then the next player can:

1: Throw away the pass move leaving every heap the same as before his move; or

2: Play a taking-and-breaking move as given by the octal game rules but he then either associates the pass move with a single non-empty heap or throws it away; or

3: If the pass move has been thrown away then the play continues as dictated by the octal game rules.

Note that a pass move can never be created and that an empty heap cannot have a pass move associated with it.

For a heap of size n, we use \overline{n} to denote the p-octal game. The G−sequence of a p-octal game can be periodic or arithmetic periodic. Moreover, we discovered a third type of regularity which is a hybrid between the two. A p-octal game is split arithmetic periodic, periodic regular or sapp regular for short, if there exist integers e, s, and p, and a set S ⊆ {0, 1, 2, …, p − 1} such that

• G(\overline{i + p}) = G(\overline{i}) for i > e and (i mod p) ∈ S,

• G(\overline{i + p}) = G(\overline{i}) + s for i > e and (i mod p) ∉ S.

This paper presents theorems for testing p-octal games for sapp regularity, periodicity and arithmetic periodicity. The latter two are special cases of the first. We prove the sapp regularity theorem and state the other theorems, leaving the proofs to the reader.

Note that each finite subtraction game, even with a pass-rule, has only a bounded number of options so that the G−sequence cannot be arithmetico periodic.

No one has found any sapp regular hexadecimal games. Furthermore, it is not known whether p-octal games exhibit any other regular behavior.

2. Periodicity Theorems

The next theorems require that the underlying octal game be periodic. The reader may wish to prove that the finite octal game d_{0}.d_{1}d_{2} … d_{k} is periodic with period length p and last exceptional value at heap size e if the period persists from heap sizes e + 1 through 2e + 2p + k. (See [3].)

Theorem 1. sapp regular p-octal games. Let \overline{G} be a finite p-octal game with the underlying octal game G given by d_{0}.d_{1}d_{2} … d_{k}. If there exist integers e, h, s, t, and p ≥ k, and a set S ⊆ {0, 1, 2, …, p − 1} such that

1: G(n + p) = G(n) for all n > e,

2: h is the least integer such that 2^{h} > max\{G(n), G(\overline{j})\} for all n, and j ≤ e or (j mod p) ∈ S, j ≤ 2e + 6p;

3: s = t2^{h};

4: G(\overline{n + p}) = G(\overline{4}) for e < n ≤ 2e + 6p and (n mod p) ∈ S

5: G(\overline{n + p}) = G(\overline{n}) + s for e < n ≤ 2e + 6p and (n mod p) ∉ S

6: max\{G(\overline{n})\} < 5s for n ≤ e + p.

Then, for n > e, we have that G(\overline{n + p}) = G(\overline{n}) for (n mod p) ∈ S and G(\overline{n + p}) = G(\overline{n})+s for (n mod p) ∉ S.

Proof. We assume that the result holds for heap sizes up to n + p − 1 for some n ≥ 2e+5p+1. Note that restriction on the saltus is artificial since this can be met by taking a sufficiently large multiple of the shortest period length. See the next section for an example.

The cases (n mod p) ∈ S and (n mod p) ∉ S are considered separately. For (n mod p) ∈ S, we will show that every value x < G(\overline{n}) is an excluded value for G(\overline{n + p}), and that no option of \overline{n + p} has G-value equal to G(\overline{n}). For (n mod p) ∉ S, we will show that every value x < G(\overline{n}) + s is an excluded value for G(\overline{n + p}), and that no option of \overline{n + p} has G-value equal to G(\overline{n}) + s. Throughout the proof, we will make use of the following observation: if (m mod p) ∉ S and m > e + jp then G(\overline{m}) ≥ js.

First, suppose that (n mod p) ∈ S and let 0 ≤ x < G(\overline{n}). Now x is an excluded value for G(\overline{n}) so there are nonnegative integers a and b such that a + b = n − u for some 0 ≤ u ≤ k, and either G(\overline{a}) ⊕ G(b) = x or G(a) ⊕ G(b) = x and so the move is permitted.

If b > e then G(b+p) = G(b) so either G(\overline{a})⊕G(b+p) = G(\overline{a})⊕G(b) = x or G(a)⊕G(b+p) = G(a) ⊕ G(b) = x.

Conversely, suppose that b ≤ e. Now a = n−u−b and since n ≥ 2e+5p+1 and u ≤ k ≤ p, we have a ≥ e + 4p + 1. Now if G(a) ⊕ G(b) = x then, as a > e, we have G(a + p) = G(a) so G(a + p) ⊕ G(b) = x. On the other hand, suppose that G(\overline{a}) ⊕ G(b) = x. Since we are assuming that (n mod p) ∈ S, we have x = G(\overline{n}) < s, by condition 2. If (a mod p) ∉ S then G(\overline{a}) ≥ 4s. But we also have G(b) < s by condition 2, so now G(\overline{a}) ⊕ G(b) > s > x, a contradiction. Therefore, (a mod p) ∈ S and so G(\overline{a + p}) ⊕ G(b) = G(\overline{a}) ⊕ G(b) = x.

In all cases, we have a + b + p = (n + p) − u so x is an excluded value for G(\overline{n + p}), as desired.

Secondly, suppose that (n mod p) ∉ S. Once again, let x be an excluded value for G(\overline{n}) with 0 ≤ x < G(\overline{n}). As above, there are nonnegative integers a and b such that a + b = n − u for some 0 ≤ u ≤ k, and either G(\overline{a}) ⊕ G(b) = x or G(a) ⊕ G(b) = x.

Suppose, first of all, that x ≥ 2s = t2^{h+1}. We show that x + s is an excluded value for G(\overline{n + p}). In this case, x contains a power of 2 greater than that contained by G(i) for any i, or by G(\overline{i}), 0 ≤ i ≤ e, or by G(\overline{a}), (a mod p) ∈ S. Therefore, neither the case G(a) ⊕ G(b) = x nor G(\overline{a}) ⊕ G(b) = x, (a mod p) ∈ S may occur. Thus we must have a > e and (a mod p) ∉ S. Now since s = t2^{h} and G(b) < 2^{h} have no powers of 2 in common, we have

G(\overline{a + p}) ⊕ G(b) = (G(\overline{a}) + s) ⊕ G(b)
= (G(\overline{a}) ⊕ G(b)) + s
= x + s

Therefore, every value in the set \{3s, 3s + 1, …, G(\overline{n}) + s − 1\} is an excluded value for G(\overline{n + p}).

Now let x be a nonnegative integer less than 3s. We will now show that x is an excluded value. Note that, since n ≥ 2e + 5p + 1, G(\overline{n}) ≥ 5s so \overline{n} has an option with value x.

Therefore, there are nonnegative integers a and b such that a + b = n − u for some 0 ≤ u ≤ k, and either G(\overline{a})⊕G(b) = x or G(a)⊕G(b) = x. Suppose that G(a)⊕G(b) = x. Since a + b = n − u ≥ (2e + 5p + 1) − p = 2e + 4p + 1, clearly at least one of a or b is greater than e. Without loss of generality, we may take b > e, then we have G(a)⊕G(b+p) = G(a)⊕G(b) = x. On the other hand, suppose that G(\overline{a})⊕G(b) = x. Then G(\overline{a}) = x⊕G(b) < x+G(b) < 3s+s = 4s so a ≤ e+4p. As above, a+b = n−u ≥ 2e+4p+1 so b ≥ e + 1 and thus G(\overline{a}) ⊕ G(b + p) = G(\overline{a}) ⊕ G(b) = x. Therefore, all 0 ≤ x < 3s are excluded values for G(\overline{n + p}) so we have shown that every value less than G(\overline{n}) + s is an excluded value.

Once again, suppose that (n mod p) ∈ S. We now show that x = G(\overline{n}) is not an excluded value for G(\overline{n + p}). To the contrary then, suppose that there are nonnegative integers a and b with a + b = n + p − u such that G(\overline{a}) ⊕ G(b) = x or G(a) ⊕ G(b) = x.

If b > e + p then G(b − p) = G(b) so either G(\overline{a}) ⊕ G(b − p) = x or G(a) ⊕ G(b − p) = x. Since a + b − p = n − u, we have produced an option of \overline{n} with value x = G(\overline{n}) which is impossible.

Conversely, if b ≤ e + p then a ≥ e + 2p + 1. If G(a) ⊕ G(b) = x then, since a > e + p, we have G(a − p) = G(a) so G(a − p) ⊕ G(b) = x. On the other hand, suppose that G(\overline{a}) ⊕ G(b) = x. As was shown earlier, we must have (a mod p) ∈ S so G(\overline{a − p}) = G(\overline{a}) and therefore, G(\overline{a − p}) ⊕ G(b) = x. In either case, we have an option of \overline{n} having value G(\overline{n}) which is impossible. Thus, when (n mod p) ∈ S, G(\overline{n}) is an excluded value for G(\overline{n + p}).

Finally, suppose that (n mod p) ∉ S. We show that G(\overline{n}) + s is an excluded value for G(\overline{n + p}). Once again, suppose that there are nonnegative integers a and b with a + b = n + p − u such that G(\overline{a}) ⊕ G(b) = x + s or G(a) ⊕ G(b) = x + s where x = G(\overline{n}).

Since (n mod p) ∉ S and n ≥ 2e + 5p + 1, we have x = G(\overline{n}) ≥ 5s and so neither the case G(a) ⊕ G(b) = x + s nor G(\overline{a}) ⊕ G(b) = x + s, (a mod p) ∈ S may occur. Therefore, (a mod p) ∉ S and a ≥ e + p + 1 by condition 6. Since s = t2^{h} and G(b) < 2^{h} have no powers of 2 in common,

G(\overline{a − p}) ⊕ G(b) = (G(\overline{a}) − s) ⊕ G(b) = (G(\overline{a}) ⊕ G(b)) − s = (x + s) − s = x = G(\overline{n}).

But (a−p)+b = n−u so we have an option of \overline{n} having value G(\overline{n}) which is a contradiction.

Therefore, when (n mod p) ∈ S, G(\overline{n}) + s is an excluded value for G(\overline{n + p}). The proof is now complete. □

This result can be used to determine whether the G−sequence is periodic, i.e., S = {0, 1, 2, …, p − 1} or arithmetic periodic, i.e. S = ∅. However, in testing for just periodicity the bounds can be sharpened. We leave the proof to the reader.

Corollary 1. Periodic p-octal games. Let \overline{G} be a finite p-octal game with the underlying octal game G given by d_{0}.d_{1}d_{2} … d_{k}. If there exist integers e and p such that

1: G(n + p) = G(n) for all n > e, and

2: G(\overline{n + p}) = G(\overline{n}) for e < n ≤ 2(e + p) + k.

Then G(\overline{n + p}) = G(\overline{n}) for n > e.

3. An Example

Consider the p-octal game 0.516. The first 52 G−values are:

2 2 2 4 4 4 6 6 8 4 4 10 8 8 8 12
12 12 11 14 15 8 12 12 11 16 15 8 18 12 11 16 15 8
20 12 11 22 15 8 20 12 11 24 15 8 26 12 11 24 15 8

Taking e = 16, h = 4, p = 36, s = 16 and

S = {0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 21, 22, 24, 25, 27, 28, 30, 31, 33, 34}

we show that this game satisfies the conditions of Theorem 1.

1. The underlying octal game is periodic with G−sequence 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, … so indeed G(i + 36) = G(i) for all i ≥ 16.

2. We have max\{G(i)\} = 2. For j ≤ 16 max\{G(\overline{j})\} = 12, and for (j mod 36) ∈ S max\{G(\overline{j})\} = 15. Thus 2^{h} = 2^{4} = 16 exceeds all these maxima as required.

3. We take t = 1 so s = 2^{4} = 16.

4. The periodic behaviour may be seen to hold up to a heap size of 2e + 6p = 248.

5. The arithmetic periodic behaviour may be seen to hold up to a heap size of 2e+6p = 248.

6. For i ≤ 52, max\{G(\overline{i})\} = 26 (at i = 47) which is less than 5s = 80.

Therefore, we conclude that, for i > 16,

G(\overline{i + 36}) = \{ \begin{matrix}G(\overline{i}) & (i mod 36) ∈ S \\ G(\overline{i}) + 16 & (i mod 36) ∉ S. \end{matrix}

Note: h = 4 is the smallest value that will work in condition 2. This led to s = 16 and p = 36. In fact, however, the G−sequence for this game is sapp with period 18 and saltus 4. G−sequences

These tables cover all the 3-digit p-octal games where the underlying octal game has a period less than 10 with a pre-period length of no more than 30. We use A = 10, B = 11, etc., and the dots signify the beginning and end of the period. In octal and hexadecimal games there is a standard form, essentially no game beginning with an even number has to be considered. No equivalent standard form exist for p-octal games.

Table 1 contains some examples of periodic p-octal games. Tables 2 and 3 list, respectively, arithmetic periodic and sapp regular games; We also found several examples of 4-digit p-octal games which are arithmetic periodic or sapp regular; many of these, however, are equivalent to 3-digit games.

Table 1: Examples of Periodic P-octal Games

Game e p Saltus First Nim-values
0.07 124 34  0  122334455647554
0.15 22 10  0  221224424466488442A78˙8788442C7Ḃ
0.17 118 34  0  2234254257
0.26 3 4  0  123˙456˙7
0.34 16 8  0  2324324523
0.35 6 6  0  231243˙46424˙6
0.44 396 24  0  112233445566778
0.45 730 20  0  11243564758897A
0.51 0 1  0  ˙2˙2
0.52 1 4  0  2˙143˙6
0.53 24 9  0  2244614471
0.54 27 7  0  2124446688
0.57 2 6  4  22˙44664˙4
0.71 5 2  0  23452˙5˙4
0.72 8 4  0  23456745˙861A˙4
0.75 1 4  4  2˙345˙4
4.12 8 7  0  22441738˙7486A4˙7
4.3  2 2  0  22˙3˙1
4.32 1 4  0  2˙465˙7
4.7  4 3  4  2453˙8A˙8
4.72 4 3  0  2468Ȧ7˙9

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 3 (2003), #G01 9

For the next two tables, many games have the same G−sequence. We use the following shorthand in the game name to designate a set of games.

\begin{aligned}m & = & 5, 7 \\ n & = & 4, 5 \\ p & = & 0, 1, 4, 5 \end{aligned} \begin{aligned}q & = & 4, 5, 6, 7 \\ r & = & 0, 1, 2, 3, 4, 5, 6, 7 \\ s & = & 1, 5 \end{aligned} \begin{aligned}t & = & 6, 7 \\ u & = & 2, 3 \\ v & = & 4, 5 \end{aligned}

Table 2: Arithmetic periodic P-octal Games

Game  e p Saltus First Nim-values
0.157  3 9  4  222˙44466644˙4
0.175  2 6  4  22˙34456˙4
0.315  3 10  4  234˙245246546˙4
0.335  2 8  4  23˙4124654˙6
0.35m  0 5  4  ˙2345˙4
0.53n 0.57p 2 6  4  22˙44664˙4
0.72q  2 6  4  23˙45674˙5
0.75r  1 4  4  2˙345˙4
4.spt  3 15 12 222˙4446884AC88ECCĊ
4.stp 4.5uv 2 8  8  22˙44684A8˙8
4.stt 4.5ut 2 3  4  22˙44˙6
4.3pm  1 5  4  2˙4646˙4
4.7pr  1 3  4  2˙46˙4
4.7tp  0 1  2  ˙2

Note: 4.spt shows that the saltus need not be a power of 2.

Table 3: Sapp Regular P-octal Games

Game e p Saltus First Nim-values
0.5st 16 18  8  22244466844A888CĊCBEF 8CCBGF 8ICBGF ˙8
4.1uv 6 12  8  224468 ˙4784A784C7E˙4

Note: Within the period, the bold face numbers are arithmetic periodic.

References.

[1] I. Althöfer, J. Bültermann, Superlinear period lengths in some subtraction games. Theoret. Comput. Sci. 148 (1995) pp. 111–119

[2] R. B. Austin, Impartial and Partizan Games, M.Sc. Thesis, The University of Calgary, 1976.

[3] E. Berlekamp, J. H. Conway, R. K. Guy, Winning Ways for your mathematical plays Vol. 1, 2nd edition, AKPeters, 2001 (1st edition, Academic Press, 1982).

[4] I. Caines, C. Gates, R. K. Guy, R. J. Nowakowski, Periods in taking and splitting games, Amer. Math Monthly 106, 359-361.

[5] J. H. Conway, On Numbers and Games, AKPeters, 2001.

[6] R. J. Guy, Unsolved Problems in Combinatorial Game Theory, Games of No Chance, R.J. Nowakowski Ed., Mathematical Sciences Research Institute Publications 29 329-337, Cambridge University Press, 1996.

[7] S. Howse, R. J. Nowakowski, Periodicity and Arithmetic-periodicity in Hexadecimal Games, to appear in J. Theoretical Comp. Sci.

[8] A. Flammenkamp, Sprague-Grundy values of some octal games: wwwhomes.uni-bielefeld.de/achim/octal.html.

[9] A. Gangolli; T. Plambeck, A note on periodicity in some octal games. Internat. J. Game Theory 18 (1989) pp. 311–320.

[10] R. J. Nowakowski, Regularity in hexadecimal games, preprint.