INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G06

NEW GAMES RELATED TO OLD AND NEW SEQUENCES

Aviezri S. Fraenkel^{1}

Department of Computer Science and Applied Mathematics, Weizmann Institute of Science, Rehovot

76100, Israel

                     fraenkel@wisdom.weizmann.ac.il

Received: 2/19/04, Revised: 11/4/04, Accepted: 11/7/04, Published: 11/9/04

Abstract

We define an infinite class of 2-pile subtraction games, where the amount that can be subtracted from both piles simultaneously, is a function f of the size of the piles. Wythoff’s game is a special case. For each game, the 2nd player winning positions are a pair of complementary sequences, some of which are related to well-known sequences, but most are new. The main result is a theorem giving necessary and sufficient conditions on f so that the sequences are 2nd player winning positions. Sample games are presented, strategy complexity questions are discussed, and possible further studies are indicated.

Keywords: 2-pile subtraction games, complexity of games, integer sequences

1. Introduction

We begin with an example. Given two piles of tokens (x, y) of sizes x, y, with 0 ≤ x ≤ y < ∞, two players alternate removing tokens from the piles according to the following two rules. A player, at his turn, can choose precisely one of them, as he sees fit.

(a) Remove any positive number of tokens from a single pile, possibly the entire pile.

(b) Remove a positive number of tokens from each pile, say k, ℓ, so that |k−ℓ| isn’t too large with respect to the position (x_{1}, y_{1}) moved to from (x_{0}, y_{0}), namely, |k − ℓ| < x_{1} + 1 (x_{1} ≤ y_{1}).

The player making the move after which both piles are empty (a leaf of the game), wins; the opponent loses. Thus, (11, 15) → (3, 4) or to (2, 4) are legal moves, but (11, 15) → (2, 3) or to (0, 3) are not. The position (0, 0) is the only leaf of this and our following games.

1http://www.wisdom.weizmann.ac.il/∼fraenkel

Table 1. The first few P -positions for G_{1}.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 3 & 4 & 5 & 7 & 8 & 9 & 10 & 12 & 13 & 14 & 15 & 16 & 18 & 19 & 20 \\ b_{n} & 0 & 2 & 6 & 11 & 17 & 25 & 34 & 44 & 55 & 68 & 82 & 97 & 113 & 130 & 149 & 169 & 190 \end{matrix}

For any acyclic combinatorial game without ties, such as G_{1}, a position u = (x, y) is labeled N (Next player win) if the player moving from u has a winning strategy; otherwise it’s a P -position (Previous player win). Denote by P the set of all P -positions, by N the set of all N-positions, and by F (u) the set of all game positions that are reachable from u in a single move. It is easy to see that for any acyclic game,

u ∈ P if and only if F (u) ⊆ N ,  (1)
u ∈ N if and only if F (u) ∩ P ≠ ∅ .  (2)

Indeed, player I, beginning from an N-position, will move to a P -position, which exists by (2), and player II has no choice but to go to an N-position, by (1). Since the game is finite and acyclic, player I will eventually win by moving to a leaf, which is clearly a P -position.

The partitioning of the game’s positions into the sets P and N is unique for every acyclic combinatorial game without ties.

Let ℤ denote the set of integers. Let S ⊂ ℤ_{≥0}, S ≠ ℤ_{≥0}, and \overline{S} = ℤ_{≥0} \ S. The minimum excluded value of S is

mex S = min \overline{S} = least nonnegative integer not in S.

Note that mex of the empty set is 0.

Table 1 portrays the first few P -positions (a_{n}, b_{n}) of G_{1}. The reader is encouraged to verify that the first few entries of the table are indeed P -positions of the game. For a technical reason we put b_{−1} = −1. In §4 we prove, as a simple corollary to a considerably more general result,

Theorem 1. For G_{1}, P = ∪_{i=0}^{∞}(a_{i}, b_{i}), where, for all n ∈ ℤ_{≥0},

a_{n} = mex {{a_{i} : 0 ≤ i < n} ⋃ {b_{i} : 0 ≤ i < n}} ,  (3)
b_{n} = b_{n−1} + a_{n} + 1.  (4)

Table 2. The first few P -positions for G_{2}.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 3 & 4 & 5 & 7 & 9 & 11 & 12 & 13 & 15 & 16 & 17 & 19 & 20 & 21 & 23 \\ b_{n} & 0 & 2 & 6 & 8 & 10 & 14 & 18 & 22 & 24 & 26 & 30 & 32 & 34 & 38 & 40 & 42 & 46 \end{matrix}

Table 3. The first few P -positions for G_{3}.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 3 & 4 & 5 & 7 & 8 & 9 & 10 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 \\ b_{n} & 0 & 2 & 6 & 11 & 20 & 38 & 71 & 136 & 265 & 523 & 1036 & 2061 & 4110 & 8207 & 16400 & 32785 & 65554 \end{matrix}

The game G_{1} is a member of the following new family of combinatorial games defined on two piles of finitely many tokens, with two types of moves: a move of type (a), and a more general move of type (b), namely, |k − ℓ| depends on the present and next position. Denote the present position by (x_{0}, y_{0}) and the position moved to by (x_{1}, y_{1}). We then require,

|(y_{0} − y_{1}) − (x_{0} − x_{1})| = |(y_{0} − x_{0}) − (y_{1} − x_{1})| < f(x_{1}, y_{1}, x_{0}),  (5)

where f is a real constraint function depending on x_{1}, y_{1}, x_{0}. If also (y_{0} − x_{0}) ≥ (y_{1} − x_{1}), then requirement (5) becomes y_{0} < f(x_{1}, y_{1}, x_{0})+y_{1} −x_{1} +x_{0}. The type (b) move defined for G_{1} is the special case f = x_{1} + 1. Here are descriptions of two additional games.

G_{2} is the same as G_{1}, except that in (b), |k−ℓ| < x_{1}+1 is replaced by |k−ℓ| < x_{0}−x_{1}.

G_{3} is the same as G_{1}, except that in (b), |k − ℓ| < x_{1} + 1 is replaced by |k − ℓ| < y_{1} − x_{1} + 1.

The first few P -positions for G_{2} and G_{3} are listed in Tables 2 and 3 respectively. In §4 we also prove, as a corollary to the master theorem (Theorem 3),

Theorem 2. For G_{2} and G_{3}, P = ∪_{i=0}^{∞}(a_{i}, b_{i}), where, for all n ∈ ℤ_{≥0}, a_{n} is given by (3). For G_{2}: b_{n} = 2a_{n}; and for G_{3}: b_{0} = 0, and for n ∈ ℤ_{≥1}, b_{n} = a_{n} + 2^{n} − 1.

Each of our games is associated with a pair of complementary sequences

A = {a_{i}}_{i=1}^{∞}, B = {b_{i}}_{i=1}^{∞}.

A special case is the well-known (classical) Wythoff game [37]. See also [4], [5], [7], [8], [13], [17], [18], [23], [24], [32], [33], [34], [38]. In fact, the classical Wythoff game is the case f(x_{1}, y_{1}, x_{0}) = 1, and the generalization considered in [17] is the case f(x_{1}, y_{1}, x_{0}) = t for any fixed t ∈ ℤ_{>0}. Whereas the winning strategy of Wythoff’s game is associated with sequences related to algebraic integers of the form (2 − t + \sqrt{t^{2} + 4})/2 (this is the golden section when t = 1), our games give rise to an infinity of sequences, some well-known, but mostly new ones.

In §2 we shall see that the pair of sequences of P -positions associated with G_{1} is related to a “self-generating” sequence of Hofstadter (see Sloane [35]). In §3 we indicate how the P -positions of G_{2} are related to another well-known sequence. The central result appears in §4, where a general theorem is formulated and proved, that yields winning strategies for a large class of 2-pile subtraction games. Roughly speaking it states that for every 2-pile subtraction game, if its constraint function f is “positive”, “monotone” and “semi-additive”, then it has P -positions (A, B), where a_{n} satisfies (3), and b_{n} has an explicit form depending on f. In a complementary proposition we show that positivity, monotonicity and semi-additivity are also necessary, in the sense that if any one of them is dropped, then there are constraint functions and their associated games G, such that the positions claimed to be P -positions by the central result, are not P -positions for these G. Theorems 1 and 2 are then deduced as simple corollaries of the central result. In §5 we give an assortment of sample games with their P -positions that can be produced from the central theorem. Questions of complexity and related issues are discussed in §6. The epilogue in §7 wraps up with some concluding remarks and indications for further study.

2. The Gödel, Escher, Bach Connection

On p. 73 of Hofstadter’s famous book [30] the reader is asked to characterize the following sequence:

B′_{n≥0} = {1, 3, 7, 12, 18, 26, 35, 45, 56, …}.

Answer: the sequence {2, 4, 5, 6, 8, 9, 10, 11, …} constitutes the set of differences of consecutive terms of B′_{n≥0}, as well as the complement with respect to ℤ_{>0} of B′_{n≥0}. For our purposes it is convenient to preface 0 to the latter sequence, so we define

A′_{n≥0} = {0, 2, 4, 5, 6, 8, 9, 10, 11, …},

which is the complement with respect to ℤ_{≥0} of B′_{n≥0}. Now a′_{10} = mex{a′_{i}, b′_{i} : 0 ≤ i < 10} = 13, so b′_{10} = 56 + 13 = 69. We see that in general, for all n ∈ ℤ_{≥0},

a′_{n} = mex {{a′_{i} : 0 ≤ i < n} ⋃ {b′_{i} : 0 ≤ i < n}} ,  (6)

which has the form (3), and

b′_{−1} = 1,  b′_{n} = b′_{n−1} + a′_{n},  (7)

which is similar to (4). Moreover, the following proposition shows that there is a very close relationship between the P -positions of the game G_{1} and Hofstadter’s sequence B′_{n≥0}, namely, b′_{n} exceeds b_{n} by 1. This can be observed by comparing the bottom row of Table 1 with B′_{n≥0}.

Proposition 1. a′_{n} = a_{n} + 1 (n ≥ 1), b′_{n} = b_{n} + 1 (n ≥ 0), where a′_{n}, b′_{n} are given by (6), (7) respectively, and a_{n}, b_{n} by (3), (4) respectively.

Proof. We see that the assertions are true for small n. Suppose they hold for all i ≤ n. Then

a′_{n+1} = mex{a′_{i}, b′_{i} : 0 ≤ i ≤ n} = mex{0, a_{i} + 1, b_{i} + 1 : 0 ≤ i ≤ n}.

Let S′_{n} = {0, a_{i} + 1, b_{i} + 1 : 0 ≤ i ≤ n}, S_{n} = {a_{i}, b_{i} : 0 ≤ i ≤ n}. If, say, the integer interval [0, k] is in S_{n} for some k ∈ ℤ_{>0} and k + 1 ∉ S_{n}, then the integers in the interval [0, k + 1] are in S′_{n} and k + 2 ∉ S′_{n}. It follows that mex S′_{n} = a_{n+1} + 1. Also, b′_{n+1} = b′_{n} + a′_{n+1} = b_{n} + 1 + a_{n+1} + 1 = b_{n+1} + 1. □

Thus the P -positions of G_{1} constitute an “offset by 1” of the Hofstadter sequence and its complement.

3. Prouhet-Thue-Morse

It is not hard to see that the sequence A_{n≥1} of G_{2} contains precisely all positive integers whose binary representation ends in an even number of zeros. The sequence A_{n≥1} is also lexicographically minimal with respect to the property that the parity of the number of 1’s in the binary expansion alternates. Furthermore, it is lexicographically minimal with respect to the property that the complement is the double of the sequence. If m appears in A, then 2m appears in B. In particular, B_{n≥1} contains precisely all positive integers whose binary representation ends in an odd number of zeros [6]. The sequence

C_{n} = 0^{a_{1}−a_{0}}1^{a_{2}−a_{1}}0^{a_{3}−a_{2}} … 0^{a_{2n+1}−a_{2n}}1^{a_{2n+2}−a_{2n+1}} …
= 011010011001011010010 …,

is the Prouhet-Thue-Morse sequence, which arises in many different areas of mathematics. See the charming paper [3], which also contains the sequence A, for many further properties of these sequences.

4. A Master Theorem

The three previously described games G_{1}, G_{2}, G_{3}, are members of an infinite family of games that we now formulate. We will then provide a general winning strategy for this family of games and prove its validity.

General 2-pile subtraction games

Given two piles of tokens (x, y) of sizes x, y, with 0 ≤ x ≤ y < ∞. Two players alternate removing tokens from the piles:

(aa) Remove any positive number of tokens from a single pile, possibly the entire pile.

(bb) Remove a positive number of tokens from each pile, say k, ℓ, so that |k − ℓ| isn’t too large with respect to the position (x_{1}, y_{1}) moved to from (x_{0}, y_{0}), namely, |k − ℓ| < f(x_{1}, y_{1}, x_{0}); equivalently:

|(y_{0} − y_{1}) − (x_{0} − x_{1})| = |(y_{0} − x_{0}) − (y_{1} − x_{1})| < f(x_{1}, y_{1}, x_{0}),  (8)

where the constraint function f(x_{1}, y_{1}, x_{0}) is integer-valued and satisfies:

• Positivity:

f(x_{1}, y_{1}, x_{0}) > 0 ∀y_{1} ≥ x_{1} ≥ 0 ∀x_{0} > x_{1}.

• Monotonicity:

x′_{0} < x_{0} ⟹ f(x_{1}, y_{1}, x′_{0}) ≤ f(x_{1}, y_{1}, x_{0}).

• Semi-additivity (or generalized triangle inequality) on the P -positions, namely: for all n > m ≥ 0,

∑_{i=0}^{m} f(a_{n−1−i}, b_{n−1−i}, a_{n−i}) ≥ f(a_{n−m−1}, b_{n−m−1}, a_{n}).

The player making the move after which both piles are empty wins; the opponent loses.

In view of (8), positivity is a natural condition. Without positivity, a move of type (bb) isn’t even possible. Monotonicity appears to be a minimal requirement to enforce positivity. Semi-additivity is a convenient condition to have, and many functions are semi-additive. Whereas positivity and monotonicity are defined on any game positions, semi-additivity is defined on the candidate P -positions. All three conditions are applied to P -positions. If all three are satisfied, then the candidates are indeed P -positions, as enunciated in Theorem 3 below. The function f depends on three independent variables x_{1}, y_{1}, x_{0} or a_{n−1}, b_{n−1}, a_{n}, and the dependent variable b_{n} — so that (a_{n}, b_{n}) ∈ P — is then computed by f.

Note that G_{1}, G_{2}, G_{3} clearly satisfy positivity and monotonicity; G_{1} and G_{3}, in whose functions f there is no a_{n}, are clearly semi-additive; and G_{2} is semi-additive with equality. (See also the proof of Theorems 1 and 2 at the end of this section.)

Theorem 3. Let S = ∪_{i=0}^{∞}(a_{i}, b_{i}), where, for all n ∈ ℤ_{≥0}, a_{n} is given by (3), b_{0} = 0, and for all n ∈ ℤ_{>0},

b_{n} = f(a_{n−1}, b_{n−1}, a_{n}) + b_{n−1} + a_{n} − a_{n−1}.  (9)

If f is positive, monotone and semi-additive, then S is the set of P -positions of a general 2-pile subtraction game with constraint function f, and the sequences A, B share the following common features: (i) they partition ℤ_{≥1}; (ii) b_{n+1} − b_{n} ≥ 2 for all n ∈ ℤ_{≥0}; (iii) a_{n+1} − a_{n} ∈ {1, 2} for all n ∈ ℤ_{≥0}.

Proof. The definition of a_{n} implies directly,

a_{n} > a_{n−1}  (10)

for all n ∈ ℤ_{>0}. ¿From (9) we have, for all n ∈ ℤ_{>0},

b_{n} − b_{n−1} = f(a_{n−1}, b_{n−1}, a_{n}) + a_{n} − a_{n−1},  (11)
b_{n} − a_{n} = f(a_{n−1}, b_{n−1}, a_{n}) + b_{n−1} − a_{n−1}.  (12)

Now f(a_{0}, b_{0}, a_{1}) > 0 by positivity, so b_{1} − b_{0} ≥ 2 by (10), (11). Hence we get, by induction on n,

b_{n} − b_{m} ≥ 2 for all n > m ≥ 0.  (13)

Similarly we get from (12),

b_{n} − a_{n} > b_{m} − a_{m} ≥ 0 for all n > m ≥ 0.  (14)

Now A and B are complementary sets of integers, i.e., A ∪ B = ℤ_{≥1} (by (3)), and A ∩ B = ∅. Indeed, if a_{n} = b_{m}, then n > m implies that a_{n} is the mex of a set containing b_{m} = a_{n}, a contradiction to the mex definition; and 1 ≤ n ≤ m is impossible since

b_{m} = f(a_{m−1}, b_{m−1}, a_{m}) + b_{m−1} + a_{m} − a_{m−1}
≥ f(a_{m−1}, b_{m−1}, a_{n}) + b_{n−1} + a_{n} − a_{n−1}

(by (10), (14) and monotonicity)

> a_{n} (by positivity).

Since b_{n} − b_{n−1} ≥ 2 for all n ≥ 1 by (13), and since A and B are complementary,

a_{n} − a_{n−1} ∈ {1, 2}  (15)

for all n ∈ ℤ_{>0}. For the remainder of the proof it is useful to denote the set S defined in the statement of the theorem by P′. Also let N′ = ℤ_{≥0} \ P′. For showing that P′ = P and N′ = N, it evidently suffices to show two things:

I. Every move from any (a_{n}, b_{n}) ∈ P′ results in a position in the complement N′.

II. From every position (x, y) in the complement N′, there is a move to some (a_{n}, b_{n}) ∈ P′.

(It is useful to note that these two conditions are also necessary: (1) implies that all positions reachable in one move from a P -position are N-positions; whereas (2) shows that at least one P -position is reachable in one move from an N-position.)

I. A move of type (aa) from (a_{n}, b_{n}) ∈ P′ has the form (x, b_{n}) or (a_{n}, y) (x < a_{n}, y < b_{n}). Both are in N′ since the sequences A and B are strictly increasing. Suppose there is a move of type (bb): (a_{n}, b_{n}) → (a_{j}, b_{j}) ∈ P′. Then j < n. Note that

|(b_{n} − b_{j}) − (a_{n} − a_{j})|
= |(b_{n} − a_{n}) − (b_{j} − a_{j})| = (b_{n} − a_{n}) − (b_{j} − a_{j})

by (14). By iterating (9) we have,

(b_{n} − a_{n}) − (b_{j} − a_{j})

= f(a_{n−1}, b_{n−1}, a_{n}) + (b_{n−1} − a_{n−1}) − (b_{j} − a_{j}) = f(a_{n−1}, b_{n−1}, a_{n}) + f(a_{n−2}, b_{n−2}, a_{n−1})

+ (b_{n−2} − a_{n−2}) − (b_{j} − a_{j})

⋮

= ∑_{i=0}^{n−j−1} f(a_{n−i−1}, b_{n−i−1}, a_{n−i}) ≥ f(a_{j}, b_{j}, a_{n}),

where the inequality follows from semi-additivity. Thus

|(b_{n} − b_{j}) − (a_{n} − a_{j})| ≥ f(a_{j}, b_{j}, a_{n}),

contradicting condition (bb).

II. Let (x, y) ∈ N′ (0 ≤ x ≤ y). Since A and B are complementary, every n ∈ ℤ_{>0} appears exactly once in exactly one of A and B. Therefore we have either x = b_{n} or else x = a_{n} for some n ≥ 0.

(i) x = b_{n}. Then move y → a_{n}. This is always possible since if n = 0, then y > a_{0} = b_{0}; whereas a_{n} < b_{n} for n ≥ 1 by (14).

(ii) x = a_{n}. If y > b_{n}, move y → b_{n}. So suppose that a_{n} ≤ y < b_{n}. Then n ≥ 1. For any m ∈ {0, …, n − 1} we have by (9) and by monotonicity,

(b_{m+1} − a_{m+1}) − (b_{m} − a_{m}) = f(a_{m}, b_{m}, a_{m+1})
≤ f(a_{m}, b_{m}, a_{n}).

Thus b_{m} − a_{m} + f(a_{m}, b_{m}, a_{n}) ≥ b_{m+1} − a_{m+1}. Therefore the intervals [b_{m} − a_{m}, b_{m} − a_{m} + f(a_{m}, b_{m}, a_{n})) (closed on the left, open on the right) cover ℤ_{≥0} for m ≥ 0. Hence

y − a_{n} ∈ [b_{m} − a_{m}, b_{m} − a_{m} + f(a_{m}, b_{m}, a_{n}))  (16)

for a smallest m ∈ ℤ_{≥0}. We then move (x, y) → (a_{m}, b_{m}). This move is legal, since:

• m < n. Indeed, y − a_{n} < b_{n} − a_{n} = f(a_{n−1}, b_{n−1}, a_{n}) + b_{n−1} − a_{n−1}. Thus m ≤ n − 1 by (16).

• y > b_{m}. By (16), y − a_{n} ≥ b_{m} − a_{m}. Hence y − b_{m} ≥ a_{n} − a_{m} > 0.

• The move satisfies (bb):

|(y − b_{m}) − (x − a_{m})| = |(y − a_{n}) − (b_{m} − a_{m})|
= (y − a_{n}) − (b_{m} − a_{m})

where the last equality follows from (16) and our choice of m. We thus have |(y − a_{n}) − (b_{m} − a_{m})| = (y − a_{n}) − (b_{m} − a_{m}) < f(a_{m}, b_{m}, a_{n}) by (16). □

We now show that if any of the three conditions of Theorem 3 is dropped, then there are games for which its conclusion fails.

Proposition 2. There exist 2-pile subtraction games with constraint functions f which lack precisely one of positivity, monotonicity or semi-additivity, such that S ≠ P, where S = ∪_{i=0}^{∞}(a_{i}, b_{i}), and a_{i} satisfies (3) (i ∈ ℤ_{≥0}); b_{0} = 0, b_{i} satisfies (9) (i ∈ ℤ_{>0}).

Proof. Consider the function f(x_{1}, y_{1}, x_{0}) = (x_{0} − x_{1})^{2}. It is clearly positive and monotone. However, (a_{n} − a_{n−1})^{2} + (a_{n−1} − a_{n−2})^{2} < (a_{n} − a_{n−2})^{2}, no matter whether a_{n} − a_{n−1} = a_{n−1} − a_{n−2} = 1 or otherwise, so f is not semi-additive. From (9) we get, b_{n} = b_{n−1} + (a_{n} − a_{n−1})(a_{n} − a_{n−1} + 1), where a_{n} satisfies (3). The first few values of (a_{n}, b_{n}) are depicted in Table 4. Note that these are not P -positions: we can move (a_{n}, b_{n}) → (a_{i}, b_{i}) in many ways; e.g., (4, 10) → (0, 0) satisfies (bb).

The function f(x_{1}, y_{1}, x_{0}) = ⌊(x_{1} + 1)/x_{0}⌋ + 1 is positive. Since

(⌊\frac{a_{n−1} + 1}{a_{n}}⌋ + 1) + (⌊\frac{a_{n−2} + 1}{a_{n−1}}⌋ + 1) > ⌊\frac{a_{n−2} + 1}{a_{n}}⌋ + 1 = 1,

Table 4. The first few values of S for f = (x_{0} − x_{1})^{2}.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 3 & 4 & 5 & 6 & 7 & 9 & 11 & 13 & 15 & 17 & 18 & 19 & 20 & 21 & 23 \\ b_{n} & 0 & 2 & 8 & 10 & 12 & 14 & 16 & 22 & 28 & 34 & 40 & 46 & 48 & 50 & 52 & 54 & 60 \end{matrix}

Table 5. The first few values of S for f = ⌊(x_{1} + 1)/x_{0}⌋ + 1.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 2 & 4 & 5 & 7 & 8 & 10 & 11 & 13 & 14 & 16 & 17 & 19 & 20 & 22 & 23 \\ b_{n} & 0 & 3 & 6 & 9 & 12 & 15 & 18 & 21 & 24 & 27 & 30 & 33 & 36 & 39 & 42 & 45 & 48 \end{matrix}

it is also semi-additive. But it is not monotone. From (9), b_{n} = b_{n−1} − a_{n−1} + a_{n} + ⌊(a_{n−1} + 1)/a_{n}⌋ + 1. The first few values of S = ∪_{n=0}^{∞}(a_{n}, b_{n}) are shown in Table 5. The game-position (4, 7) ∉ S, but it cannot be moved into S. Hence S ≠ P. (Incidentally, note that the sequence B consists of all nonnegative multiples of 3.)

Lastly, consider f(x_{1}, y_{1}, x_{0}) = (1 + (−1)^{y_{1}+1}) x_{1}/2. We see easily that f is semiadditive, and it’s trivially monotone. But whenever y_{1} is even, f is not positive. We have, b_{n} = a_{n} + b_{n−1} − (1 + (−1)^{b_{n−1}}) a_{n−1}/2. Table 6 shows the first few S-positions. These are not P -positions: The position (10, 29) ∉ S, cannot be moved into any position in S. □

Table 6. The first few values of S for f = (1 + (−1)^{y_{1}+1}) x_{1}/2.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 2 & 4 & 5 & 6 & 8 & 9 & 10 & 11 & 14 & 15 & 16 & 17 & 18 & 19 & 20 \\ b_{n} & 0 & 1 & 3 & 7 & 12 & 13 & 21 & 30 & 31 & 42 & 45 & 60 & 61 & 78 & 79 & 98 & 99 \end{matrix}

Table 7. The first few values of S for f = x_{1} − ⌊(x_{1} + 1)/x_{0}⌋ + 2.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 3 & 4 & 5 & 6 & 8 & 9 & 10 & 11 & 13 & 14 & 15 & 16 & 17 & 19 & 20 \\ b_{n} & 0 & 2 & 7 & 12 & 18 & 25 & 35 & 45 & 56 & 68 & 83 & 98 & 114 & 131 & 149 & 170 & 191 \end{matrix}

Proof of Theorems 1 and 2. The function f(x_{1}, y_{1}, x_{0}) = x_{1} + 1 is clearly positive. Monotonicity is satisfied trivially. It’s also clear that f is semi-additive. The function f(x_{1}, y_{1}, x_{0}) = x_{0} − x_{1} is positive, since x_{0} > x_{1}. It’s also monotone. Since (a_{n+1} − a_{n}) + (a_{n} − a_{n−1}) = a_{n+1} − a_{n−1}, we see that f is semi-additive. Finally, the function f(x_{1}, y_{1}, x_{0}) = y_{1} − x_{1} + 1 is positive for all x_{1} ≤ y_{1} and is trivially monotone. It’s also semi-additive. Thus by Theorem 3 we have for G_{1}, b_{n} = a_{n−1} + 1 + b_{n−1} − a_{n−1} + a_{n} = b_{n−1} +a_{n} +1, as stated in Theorem 1. For G_{2}, (9) implies, b_{n} = a_{n} −a_{n−1} +b_{n−1} −a_{n−1} + a_{n} = 2a_{n} − 2a_{n−1} + b_{n−1} = 2a_{n}, where the last equality follows by induction on n. For G_{3}, b_{n} = b_{n−1} − a_{n−1} + 1 + b_{n−1} − a_{n−1} + a_{n} = 2(b_{n−1} − a_{n−1}) + a_{n} + 1 = a_{n} + 2^{n} − 1. Again the last equality follows by induction. □

5. Further Sample Games

For the examples below, we leave it to the reader to verify positivity, monotonicity and semi-additivity of f. Some of these examples are elaborated on in the next two sections.

Example 1. f(x_{1}, y_{1}, x_{0}) = x_{1} − ⌊(x_{1} + 1)/x_{0}⌋ + 2. Then b_{n} = b_{n−1} + a_{n} − ⌊(a_{n−1} + 1)/a_{n}⌋ + 2. The first few P -positions are depicted in Table 7.

Example 2. f(x_{1}, y_{1}, x_{0}) = x_{0} − x_{1} + 2. Then b_{n} = b_{n−1} + 2(a_{n} − a_{n−1} + 1) = 2(a_{n} + n). See Table 8 for the first few P -positions.

Example 3. f(x_{1}, y_{1}, x_{0}) = (−1)^{y_{1}} −(−1)^{x_{1}} +3. Then b_{n} = b_{n−1} −a_{n−1} +a_{n} +(−1)^{b_{n−1}} − (−1)^{a_{n−1}} + 3. See Table 9 for the first few P -positions.

Example 4. f(x_{1}, y_{1}, x_{0}) = x_{1} (1 + (−1)^{x_{1}})+1. This leads to b_{n} = b_{n−1}+(−1)^{a_{n−1}}a_{n−1}+ a_{n} + 1. Table 10 exhibits the first few P -positions.

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G06 12

Table 8. The first few values of S for f = x_{0} − x_{1} + 2.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 2 & 3 & 5 & 6 & 7 & 9 & 10 & 11 & 13 & 14 & 15 & 16 & 17 & 19 & 20 \\ b_{n} & 0 & 4 & 8 & 12 & 18 & 22 & 26 & 32 & 36 & 40 & 46 & 50 & 54 & 58 & 62 & 68 & 72 \end{matrix}

Table 9. The first few values of S for f = (−1)^{y_{1}} − (−1)^{x_{1}} + 3.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 2 & 3 & 5 & 6 & 7 & 8 & 9 & 11 & 12 & 13 & 15 & 16 & 17 & 18 & 19 \\ b_{n} & 0 & 4 & 10 & 14 & 21 & 25 & 27 & 31 & 33 & 38 & 44 & 48 & 55 & 59 & 61 & 65 & 67 \end{matrix}

Table 10. The first few values of S for f = x_{1} (1 + (−1)^{x_{1}}) + 1.

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\ a_{n} & 0 & 1 & 3 & 4 & 6 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 19 & 20 \\ b_{n} & 0 & 2 & 5 & 7 & 18 & 33 & 42 & 44 & 66 & 68 & 94 & 96 & 136 & 138 & 172 & 175 & 177 \end{matrix}

6. Computational Complexity Issues

What is the computational complexity of computing the winning strategy for our games? Given a position (x, y) with 0 ≤ x ≤ y < ∞, the statement of Theorem 3 enables us to compute the table of P -positions. It suffices to compute it up to the smallest n = n_{0} such that a_{n_{0}} ≥ x, and thus determine whether (x, y) ∈ P or in N. The proof of Theorem 3 then enables us, if (x, y) ∈ N, to make a winning move to a position in P. The latter part of the strategy, that of making a winning move, is clearly polynomial. The first part, determining whether or not (x, y) ∈ P is linear in x, since a_{n_{0}} ≤ 2x by (15).

Our games, however, are succinct, i.e., the input size is Ω(log x) rather than Ω(x) (assuming that y is bounded by a polynomial in x). Thus their complexity isn’t obvious a priori. Even if the sequence B grows exponentially, polynomiality of the strategy doesn’t necessarily follow. For example, I don’t know whether the sequence B of G_{3} can be computed polynomially.

Special sequences are known to be computable polynomially. For example, consider the numeration system with bases defined by the recurrence u_{n} = (s + t − 1)u_{n−1} + su_{n−2} (n ≥ 1), where s, t ∈ ℤ_{>0}, with initial conditions u_{−1} = 1/s, u_{0} = 1. It follows from [19] that every positive integer N has a unique representation of the form N = ∑_{i≥0} d_{i}u_{i}, with digits d_{i} ∈ {0, …, s + t − 1}, such that d_{i+1} = s + t − 1 ⟹ d_{i} < s for all i ∈ ℤ_{≥0}. The representation of the first few entries for the special case s = 2, t = 2, is depicted in Table 10.

If we compare Table 11 with Table 8, we might note the following two properties:

• All the a_{n} have representations ending in an even number of 0s, and all the b_{n} have representations ending in an odd number of 0s.

• For every (a_{n}, b_{n}) ∈ P, the representation of b_{n} is the “left shift” of the representation of a_{n}.

Thus (1, 4) of Table 8 has representation (1, 10), and (6, 22) has representation (12, 120): 10 is the “left shift” of 1, 120 the left shift of 12.

These properties hold, in fact, in general for Example 2, which is a member of another family of sequences and games analyzed in [21]. They enable one to win in polynomial time for that family.

However, we don’t even know whether there are NP-hard sequences. A case in point is the infinite family of octal games [29], [4] ch. 4, even for the subfamily where there are only finitely many nonzero octal digits. Some octal games have been shown to have polynomial strategies, (see e.g., [27]), but the complexity of most is unknown.

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G06 14

Table 11. Representation of the first few integers in a special numeration system.

50 14 4 1 n 14 4 1 n
2 0 3 31  1 1
2 1 0 32  2 2
2 1 1 33  3 3
2 1 2 34  1 0 4
2 1 3 35  1 1 5
2 2 0 36  1 2 6
2 2 1 37  1 3 7
2 2 2 38  2 0 8
2 2 3 39  2 1 9
2 3 0 40  2 2 10
2 3 1 41  2 3 11
3 0 0 42  3 0 12
3 0 1 43  3 1 13
3 0 2 44 1 0 0 14
3 0 3 45 1 0 1 15
3 1 0 46 1 0 2 16
3 1 1 47 1 0 3 17
3 1 2 48 1 1 0 18
3 1 3 49 1 1 1 19
1 0 0 0 50 1 1 2 20
1 0 0 1 51 1 1 3 21
1 0 0 2 52 1 2 0 22
1 0 0 3 53 1 2 1 23
1 0 1 0 54 1 2 2 24
1 0 1 1 55 1 2 3 25
1 0 1 2 56 1 3 0 26
1 0 1 3 57 1 3 1 27
1 0 2 0 58 2 0 0 28
1 0 2 1 59 2 0 1 29
1 0 2 2 60 2 0 2 30

We mention very briefly other relevant complexities. They include Kolmogorov complexity, subword complexity, palindrome complexity, and, we might add, squares complexity. The subword complexity c(n) of a sequence S is the number of distinct words of length n occurring in S. In [2], this notion is attributed to [14]. Surveys can be found in [1], [15], [16]. The palindrome complexity p(n) of S is the number of distinct palindromes of length n in S. See e.g., [12], [2]. Define the squares complexity s(n) of S as the number of distinct squares of length n in S. Thus the result of [26] implies that there are binary sequences for which s(2) = 2, s(4) = 1, s(2k) = 0 for all k > 2. There is also the notion of program complexity [9], [10], [11] concerning the complexity of computing a sequence, which is related to Kolmogorov complexity [31].

7. Epilogue

We have defined an infinite class of 2-pile subtraction games with two types of moves: (aaa) remove any positive number from a single pile; (bbb) remove k > 0 from one pile, ℓ > 0 from the other. This move is restricted by the requirement |k − ℓ| < f, where f is a positive real-valued function. We have shown that a pair A, B of judiciously chosen complementary sequences constitutes the set of P -positions if and only if f is monotone and semi-additive.

As we have pointed out, the generalized Wythoff game [17] is a member of the family of games considered here. It has the property that a polynomial strategy can be given by using a special numeration system, and noting that the elements of A are characterized by ending in an even number of 0s in that representation, and those of B are their left shifts. A similar situation exists for G_{2}, but with the standard binary representation as numeration system. With the game in Example 2, an essentially different numeration system (see [21]) can be associated to the same effect.

Further studies

1. With which games can we associate an appropriate numeration system so as to establish a polynomial strategy?

2. Extend the games in a natural way to handle more than two piles. This seems to be difficult for Wythoff’s game, for which I have a conjecture; see [20] §6(2), [28] Problem 53, [22] §5, [36].

3. Compute the Sprague-Grundy function g for the games, which will enable to play sums of games. For Wythoff’s game this is an as yet unsolved problem, though eventual additive periodicity has been proved [13], [32].

4. Compute a strategy for the games when played in misère version, i.e., the player making the last move loses. This is easy for Wythoff’s game. See [4], ch. 13.

5. We have already mentioned the question of the polynomiality of the strategy. Is there a 2-pile subtraction game that’s Pspace-complete?

6. Computation of complexities of P -positions sequences, such as Kolmogorov-, program-, subword-, palindrome-, squares-complexities. For the sequence A of Example 2, the subword complexity was computed in [25].

7. Make an about-face: begin with pairs of known complementary sequences, and design matching 2-pile subtraction games.^{2}

References

[1] J-P. Allouche, Sur la complexitè des suites infinies, Bull. Belg. Math. Soc. 1 (1994) 133–143.

[2] J-P. Allouche, M. Baake, J. Cassaigne, D. Damanik, Palindrome complexity, Theoret. Comput. Sci. 292 (2003) 9–31.

[3] J-P. Allouche and J. Shallit, The ubiquitous Prouhet-Thue-Morse sequence, in: Sequences and their applications (Singapore, 1998), 1–16, Springer Ser. Discrete Math. Theor. Comput. Sci., Springer, London, 1999.

[4] E.R. Berlekamp, J.H. Conway and R.K. Guy, Winning Ways for your Mathematical Plays, Vol. I & II, Academic Press, London, 1982.

[5] U. Blass and A.S. Fraenkel [1990], The Sprague–Grundy function for Wythoff’s game, Theoret. Comput. Sci. (Math Games) 75 (1990) 311–333.

[6] L. Carlitz, R. Scoville and V.E. Hoggatt Jr., Representations for a special sequence, Fibonacci Quart. 10 (1972) 499–518; 550.

[7] I.G. Connell, A generalization of Wythoff’s game, Canad. Math. Bull. 2 (1959) 181–190.

[8] H.S.M. Coxeter, The golden section, phyllotaxis and Wythoff’s game, Scripta Math. 19 (1953) 135–143.

[9] R. P. Daley, Minimal-program complexity of sequences with restricted resources, Information and Control 23 (1973) 301–312.

[10] R. P. Daley, The extent and density of sequences within the minimal-program complexity hierarchies, J. Comput. System Sci. 9 (1974) 151–163.

[11] R. P. Daley, Minimal-program complexity of pseudo-recursive and pseudo-random sequences, Math. Systems Theory 9 (1975) 83–94.

[12] D. Damanik and D. Zare, Palindrome complexity bounds for primitive substitution sequences, Discrete Math. 222 (2000) 259–267.

[13] A. Dress, A. Flammenkamp and N. Pink, Additive periodicity of the Sprague-Grundy function of certain Nim games, Adv. in Appl. Math. 22 (1999) 249–270.

[14] A. Ehrenfeucht. K. P. Lee, G. Rozenberg, Subword complexities of various classes of deterministic developmental languages without interaction, Theoret. Comput. Sci. 1 (1975) 59–75.

2A first version of this paper appeared in A.S. Fraenkel, New games related to old and new sequences, Advances in Computer Games, Proc. 10-th Advances in Computer Games Conference (ACG-10), Nov. 2003, Graz, Austria (H.J van den Herik, H. Iida, E.A. Heinz, eds.), pp. 367–382, Kluwer, 2004.

[15] S. Ferenczi, Complexity of sequences and dynamical systems, Discrete Math. 206 (1999) 145–154.

[16] S. Ferenczi, Z. Kása, Complexity for finite finite factors of infinite sequences, Theoret. Comput. Sci. 218 (1999) 177–195.

[17] A.S. Fraenkel, How to beat your Wythoff games’ opponent on three fronts, Amer. Math. Monthly 89 (1982) 353–361.

[18] A.S. Fraenkel, Wythoff games, continued fractions, cedar trees and Fibonacci searches, Theoret. Comput. Sci. 29 (1984) 49–73.

[19] A.S. Fraenkel, Systems of numeration, Amer. Math. Monthly 92 (1985) 105–114.

[20] A.S. Fraenkel, Scenic trails ascending from sea-level Nim to alpine chess, in: Games of No Chance, Proc. MSRI Workshop on Combinatorial Games, July, 1994, Berkeley, CA (R. J. Nowakowski, ed.), MSRI Publ. Vol. 29, Cambridge University Press, Cambridge, pp. 13–42, 1996.

[21] A.S. Fraenkel, Heap games, numeration systems and sequences, Annals of Combinatorics 2 (1998) 197–210.

[22] A.S. Fraenkel, Complexity, appeal and challenges of combinatorial games, Proc. of Dagstuhl Seminar “Algorithmic Combinatorial Game Theory”, Theoret. Comp. Sci 313 (2004) 393– 415, special issue on Algorithmic Combinatorial Game Theory.

[23] A.S. Fraenkel and I. Borosh, A generalization of Wythoff’s game, J. Combin. Theory (Ser. A) 15 (1973) 175–191.

[24] A.S. Fraenkel and M. Ozery, Adjoining to Wythoff’s game its P -positions as moves, Theoret. Comput. Sci. 205 (1998) 283–296.

[25] A.S. Fraenkel, T. Seeman and J. Simpson, The subword complexity of a two-parameter family of sequences, Electronic J. Combinatorics 8(2) (2001) R10, 19pp. http://www.combinatorics.org/

[26] A.S. Fraenkel and R.J. Simpson, How many squares must a binary sequence contain? Electronic J. Combinatorics 2 (1995) R2, 9pp. http://www.combinatorics.org/

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

[28] R.K. Guy and R.J. Nowakowski, Unsolved problems in combinatorial games, in: More Games of No Chance, Proc. MSRI Workshop on Combinatorial Games, July, 2000, Berkeley, CA, MSRI Publ. (R.J. Nowakowski, ed.), Vol. 42, Cambridge University Press, Cambridge, pp. 457–473, 2002.

[29] R.K. Guy and C.A.B. Smith [1956], The G-values of various games, Proc. Camb. Phil. Soc. 52 (1956) 514–526.

[30] D.R. Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid, Basic Books, New York, 1979.

[31] A. N. Kolmogorov, Three approaches to the quantitative definition of information, Internat. J. Comput. Math. 2 (1968) 157–168. (An English translation of the original Russian article in Problemy Peredači Informacii 1 (1965),vyp. 1, 3–11.)

[32] H. Landman, A simple FSM-based proof of the additive periodicity of the Sprague-Grundy function of Wythoff’s game, in: More Games of No Chance, Proc. MSRI Workshop on Combinatorial Games, July, 2000, Berkeley, CA, MSRI Publ. (R. J. Nowakowski, ed.), Vol. 42, Cambridge University Press, Cambridge, pp. 383–386, 2002.

[33] R. Silber, A Fibonacci property of Wythoff pairs, Fibonacci Quart. 14 (1976) 380–384.

[34] R. Silber, Wythoff’s Nim and Fibonacci representations, Fibonacci Quart. 15 (1977) 85–88.

[35] N.J.A. Sloane, My favorite integer sequences, Sequences and their applications (Singapore, 1998), Springer Ser. Discrete Math. Theor. Comput. Sci., Springer, London, pp. 103–130, 1999.

[36] X. Sun and D. Zeilberger, On Fraenkel’s N-heap Wythoff’s conjectures, Ann. Comb. 8 (2004), 225–238.

[37] W.A. Wythoff, A modification of the game of Nim, Nieuw Arch. Wisk. 7 (1907) 199–202.

[38] A.M. Yaglom and I.M. Yaglom, Challenging Mathematical Problems with Elementary Solutions, Vol. II, Holden-Day, San Francisco, translated by J. McCawley, Jr., revised and edited by B. Gordon, 1967.