Superpolynomial period lengths of the winning positions in the subtraction game
Abstract
Given a finite set of positive integers, , and starting with a heap of chips, Alice and Bob alternate turns and on each turn a player chooses with smaller or equal than the current number of chips and subtract chips from the heap. The game terminates when the current number of chips becomes smaller than and no moves are possible. The player who makes the last move is the winner. We can define to be if Alice has a winning strategy with a starting heap of chips and if Bob has a winning strategy. By the Pigeonhole Principle, becomes periodic, and it is easy to see that the period length is at most an exponential function of . The typical period length is a linear function of , and it is a long time open question if exponential period length is possible.
We consider a slight modification of this game by introducing an initial seed that tells for the few initial numbers of chips whether the current or the opposite player is the winner. In this paper we show that the initial seed cannot change the period length of if the size of is or , but it can change the period length with . Further, we exhibit a class of sets of size and corresponding initial seeds such that the period length becomes a superpolynomial function of .
1 Introduction
Game Theory is the theory of interactive situations or games among rational decision-makers or players in which the decisions of each player are contingent on the decisions of the others. Combinatorial Game Theory considers games with perfect information and without elements of chance. That is, at all times during the game, players have perfect information about the state of the game, and further, the moves in the game are entirely decided by the players, there is no elements of chance once the game has begun. We further require that a combinatorial game must end with a clear winner.
An example of a two-player combinatorial game is the subtraction game. For a finite set , the -subtraction game is a two-player combinatorial game which proceeds as follows. We begin with heap of -chips. Players Alice and Bob alternate turns, and on each turn a player chooses with , and subtracts chips from the heap, leaving remaining. The game terminates when and thus no moves are possible. The player who makes the last move is the winner. In general we consider a fixed and ask for which values of each player has a winning strategy. Note that when Alice makes a move , Bob and Alice switch roles and we reduce to the game.
The subtraction game is also in the large class of combinatorial games called impartial games. An impartial game is a combinatorial game in which the allowable moves depend only on the position and not on which of the two players is currently moving, and where the payoffs are symmetric. It is also in normal mode, meaning that the winner is who can make the last possible move. The Sprague-Grundy theorem [11, 8] says that any impartial game in normal mode is equivalent with a Nim game, which is the disjunctive sum of -subtraction games. Despite this reduction, we know little about the patterns of the winning positions of the subtraction game.
For any finite set , a dynamic programming recursion can compute which player has the winning strategy starting with a pile of size . Simple reasoning by Pigeonhole Principle shows that the pattern of winning positions will eventually become periodic as takes all possible positive integers, and the period length cannot be longer than . It is a long time open question if exponential period lengths exist in the substraction game. Althöfer and Bültermann conjectured that superpolynomial period lengths might exist if [1].
For some , the subtraction game has a pre-period in the winning positions before becomeing periodic, that is, a pattern of winning positions for small that is never repeated. We also know little about for which the subtraction game has a pre-period and for which it is purely periodic, that is, has no pre-period.
In this paper, we generalize the subtraction game by modifying who is the winner for some small . We call this initial pattern a seed. We give a complete analysis of subtraction games with seeds for and . We prove that for all seeds the game has no pre-period if or . For , the period length is . For , the period length can be any divisor of , with a few exceptions. If and are relatively prime then the period can be any divisor except , , and . We also compute the number of possible distinct period lengths over all seeds. When , then there might be pre-periods. We give characterisations of period and pre-period lengths for a large class of possible sets . Finally, we show that superpolynomial period lengths exist already when .
2 Preliminaries
Definition 1.
Let be the winning indicator function of , so if Alice (the first player) has a winning strategy and if Bob has a winning strategy.
For brevity, we may use to refer to . By definition, satisfies the recurrence relation
(1) |
This follows from the observation that for a particular , Alice is in a winning position if she can subtract some to give Bob a losing position. Otherwise, she will certainly move to a winning position for Bob, and he will win. We can then also describe as the lexicographically least sequence in such that for all , .
Note that it is natural to define , because if a player has previously made a move to , then the next player will lose. Therefore, to satisfy recurrence relation (1) we shall define for all .
To describe an entire sequence of winning positions, abbreviated as , we use exponents to denote repeated values. A noted example in [3, p. 86] is the set . We find that , which can be abbreviated to . In this example we have , , and . This follows from the rule that if , Alice is unable to move, but at , Alice may subtract 2 chips and win the game. Similarly because for any move Alice makes, Bob can respond with a winning move. In general, if we present a prefix of of length , we use “” to indicate the continuation of the sequence and clarify the prefix’s length for the reader. For example, may indicate that the first values of are given and the rest are not yet derived. Throughout the paper, we refer to . The following example is an easy generalization of one in [3, p. 103].
Example 2.1.
Suppose . Then , so .
Proof.
Suppose . We claim Bob has a winning strategy. If Alice subtracts , then Bob can subtract , reducing to chips. Bob can repeat this until there are chips, winning the game. Suppose . Then Alice has a winning strategy. She may chips, reducing the game to , then play as Bob would by countering each of his moves with . ∎
We define a notation for repeated concatenation of strings. By analogy to addition, for strings , let
This notation satisfies the equality . Recall that sequence concatenation is not a commutative operation, although the usual summation of numbers is one. When we use a summation symbol for a concatenation of strings, we will always use an index that defines the order of the concatenation.
Definition 2.
A sequence is periodic over if there is some such that for all , . We say the period of is the least such and the preperiod is the least such . We denote these by and respectively.
In Example 2.1 we have and . We also observe that and , because for all it holds that .
Lemma 2.2.
For any finite set , is periodic.
Proof.
To prove this fact, we define a new tool called the vector of previous values. Given , let
(2) |
As shown above, will be an element of . Next, we use the recurrence relation to define a function .
(3) |
Thus by Recurrence 1, we have . Note that has elements, so by the Pigeonhole Principle there must be distinct integers such that . Therefore for all , we have the equality
Therefore a single repeated vector guarantees periodicity of length . ∎
Indeed this Lemma often fails for infinite set games.
Proposition 2.3.
For some , suppose . Then the sequence is not periodic.111For , the losing positions of this sequence are in the Online Encyclopedia of Integer Sequences [10, A030193]
Proof.
We first show there must be infinitely many losing positions by contradiction. Suppose there are losing positions. Among all integers , there are elements of . Because each winning position can be expressed as a losing position plus some , there can be combinatorially at most distinct winning positions . This implies , which contradicts finiteness of losing positions. Thus has infinitely many zeros. If we suppose is periodic after some with period , then there is some with . This implies that after periods, we will have , contradicting . ∎
The proof of Lemma 2.2 gives the result that for any finite , . We can get a slightly tighter bound for dense sets, but no less than exponential in .
Theorem 2.4.
For , let . Then
(4) |
Proof.
First, we show that there cannot be a string of ones longer than in . If some is preceded by a string of ones, then for all , so . Alternately, if is preceded by a string of ones, this implies that in particular , and is preceded by ones. This means that for all except for , we have and therefore . Because , by process of elimination we conclude that . Therefore . Thus for all , so . Hence bounds the number of consecutive ones in .
Now, let be the zero in . By the proof above , so . In order to have , we require that within the vector , the entry for all . This fixes entries, so there are possibilities for . By the Pigeonhole Principle, there is some repeated vector for some , and . This proves the claim. ∎
A similar argument can give a bound of . Using the approach from Proposition 2.3, we can see that there are at most ways to express a winning position less than , which yields this improved constant.
2.1 Initial Seed
We can generalize the subtraction game by changing the end state of the game. In [1, (ix)], Althöfer and Bülterman suggest that this variant “may be interpreted as simulations of certain computing devices,” and pose open questions about this game. Through the analysis in Sections 3, 4, and 6 we find that this generalization also provides insights into the original game. We begin with two motivating examples.
Example 2.5.
The Miseré mode of the -subtraction game is the same game except the player to make the last move is the loser.
Example 2.6.
The Greedy mode of the -subtraction game is the same game except a player may take chips, thereby making the heap negative. The game concludes when then heap is negative, and the player to make the last move is the winner. This is close to the version studied in [1].222The exact game studied in [1] is the same but has ; this cannot be generated from a seed as there is no function satisfying recurrence 1 for all . For example, if , we desire , , and . Any choice of leads to a contradiction.
Notice that for , the recurrence relation for both of these games is the same as Equation (1), but the ultimate sequence of winning positions may be different because of the players’ final goals. We can account for this by adjusting negative values of , then allowing the recurrence relation to proceed for .
Definition 3.
Define the seed of a game to be the value of , determining for . The recurrence relation follows, so , with defined in Equation (3). We define to be the sequence generated by seed . Further define and to be the period and preperiod of .
For ease of notation, we interpret more generally as the negative values of . Ordinarily , and if not then is taken to be the last elements of . Similarly, if , then we presume to be preceded by infinitely many ’s, so let . It follows from this convention and Definition 2 that , and thus in general we refer to a game with seed as having ‘no seed’.
In Example 2.5, we observe that generates the sequence of winning positions for the Miseré mode of the subtraction game, and in Example 2.6, we see that generates the sequence for the Greedy game. By considering all seeds in we describe a larger class of games. Some seeds generate games which are similar or identical to the original, while some are dramatically different. For example, the Miseré and Greedy modes cause only a translation in by and respectively.
Notice that Results 2.2 - 2.4 consider the recurrence in generality and therefore hold for all seeds. In order to characterize over all seeds, we provide the following notation for the set of all winning sequences and their periods.
(5) | ||||
(6) |
Thus is the set of all games, i.e. all sequences satisfying recurrence relation 1, and is the set of their periods. For general , a natural open question is to find .
2.2 Properties of Subtraction Games.
If the elements of are not coprime, we can interpret the sequence as multiple games proceeding in parallel. Formally, choose finite with maximum and , and denote . Then given some seed with , where , we break into classes modulo by defining for such that for all , we have . Thus and can be decomposed into ’s. By analogy, similarly define . We observe that depends only on .
Proposition 2.7 (Multiplicative Linearity).
For any , set , and seed with , then
(7) |
So if for all , then and . This condition holds for , implying that and .
Proposition 2.7 follows by applying the recurrence relation to .
Definition 4 (Extension).
Choose set and seed . We say is an extension of if .
Proposition 2.8 (Better Definition of Extension).
For is an extension of if and only if for all it holds that .
Proof.
Let . Suppose it holds that , but , and choose the least where they differ. If , then for some , , so . If instead , then , so indeed , contradicting that .
In the other direction, suppose but there is some with and . This contradicts the recurrence relation for . ∎
This means that we can identify redundant elements of a set if they are extensions of the other elements. The following proposition is a digression, but
Proposition 2.9.
For all finite or infinite sets , if and , then , so every element of greater than is redundant as an extension of . There is no analogous statement for sequences with preperiods; for example , but no other set generates that sequence.
Proof.
For the first statement, let . Suppose for the sake of contradiction there is some least such that . By the recurrence relation it must be that and , and for some . By our definitions so . Then so there is some such that . Therefore , so , a contradiction. For the second statement, suppose . Suppose . Then , so . Suppose . Then , so . Therefore . It is easy to see that is a valid choice. Suppose , and is the least element of . Then surely for all . However, for all , , , so , a contradiction. Thus is the only set generating this sequence.∎
The following proposition gives another way to identify these extensions, which we use later in the paper.
Proposition 2.10.
If is periodic over and , then for all and , is an extension of .
Proof.
Suppose and . Choose any and , and such that . By the recurrence . If , then by periodicity . Otherwise, because we have no seed. Thus by the better definition is an extension of . ∎
The following elementary example can be found in [9, thm 1].
Example 2.11.
If , then , so and . Because , any odd number is an extension of .
From Example 2.1, if and , then and . The set is an example for .
We must be careful to note that Proposition 2.10 does not hold for all seeds. If we do allow for initial seeds , the induction step fails for . This margin leads to many counterexamples; we provide two. Let and . We find and , so let . Then:
These are vastly different and we even caused a preperiod of length . As another example:
We also note that the converse of Proposition 2.10 does not hold, though it appears to hold if . For example, let . Then , so , . However it is true that for all and , is indeed an extension of . Also see the counterexample .
Contrasting these complex examples with Example 2.11, we see that sequences are easiest to examine with no seed and no preperiod. The following Lemma can simplify the process of checking whether a sequence is in this form.
Lemma 2.12 (Translating zeros).
Given a set , then for any , is periodic over and has no preperiod if and only if it holds for all and that
We call this “translating zeros” because suggests that , but does not discuss the translation of the ’s. Note that it does not a priori imply that the zeros translate, since only is considered.
Proof.
Suppose for the sake of contradiction that the premise holds but there is some least such that . There are two cases.
-
(i)
If , then , so there is some such that but . Because there is no seed this implies , and because this contradicts the minimality of .
-
(ii)
If , then , so there is some with but . If , then this would contradict the minimiality of . Otherwise, and , so the premise implies that , a contradiction.
Either case leads to a contradiction, so for all , we have . In the other direction, if is periodic with no preperiod then the condition follows by definition. ∎
Corollary 2.12.1.
If for any , then and if and only if for all .
Proof.
Apply Lemma 2.12 for . For all , if , then by the recurrence. If , then . If , then we note that for all , . Therefore it suffices to check that for , we have . Simplify by substituting . ∎
This Corollary will likely help in proving Conjecture 3.
Corollary 2.12.2.
If , then and if and only if .
These corollaries give some insight to the usefulness of the translating zeros Lemma. For Corollary 2.12.2 we can determine the period and preperiod by checking one value of the sequence! This will be used in Section 4.
Lemma 2.13.
The following statements are equivalent.
-
(i)
is periodic over with no preperiod
-
(ii)
For all ,
-
(iii)
For all ,
-
(iv)
-
(v)
For all , for each , we have .
3 The case
We first inspect the case when . If , then the recurrence relation in Equation 1 gives that for all . This gives us an immediate characterization of the periodicity for all possible seeds.
Proposition 3.1.
Let . For all seeds , let be the string exchanging ’s and ’s. Then , so and .
This gives the result that and thus .
Proposition 3.2.
Let , and let , where is odd. Then .
Proof.
First, we show that must be of the form . We know that will always be periodic over , so . Additionally, we know for all , so . Therefore . We now show that for any we have . Because is odd let . Then let , so we conclude and . ∎
These initial results are apparent at first inspection of the problem. With more work will get similarly general results for .
Theorem 3.3.
Let . For all seeds , and .
Proof.
Let . For all , in the case where we have , which implies that . Alternately, if , then or , so by the -case we know or respectively. This means . ∎
The following Theorem on -set games with no seed is well known and can be found in [4, p. 530].
Theorem 3.4.
Let with , and let with . Then
(8) |
so if is an odd multiple of and otherwise.
Proof.
For , we note that by having no seed . This implies . This yields the sequence . For , we note that so and thus . Theorem 3.3 implies that this period repeats. ∎
3.1 A Preliminary Tool: Studying
Theorem 3.4 characterizes the period structure for the default seed. Our next goal is to describe the sequence under all seeds. One corollary of the following theorems is that for any coprime, . At present, it seems like it should be possible to find a seed which generates a period of or as long as or , but in fact it is not. We will give a full characterization of all period structures and lengths which will make this fact obvious. To do this, we first analyze the special case where .
Theorem 3.5.
Suppose we have and a string with no-subperiod. Then if and only if and is some concatenation of and under some rotation.
Proof.
Suppose that . By the assumption that has no sub-period, , so by Theorem 3.3 . Next we will show that has no two consecutive ’s or three consecutive ’s. By the recurrence relation, implies . Additionally, suppose for some sufficiently large that This implies , so by Theorem 3.3 . These two restrictions mean that is a concatenation of and under some rotation. Suppose that for and is some concatenation of and . For the seed we can simply choose , so it suffices to show that satisfies the recurrence relation. Choose . First, suppose . Because there are no consecutive ’s, , which satisfies the recurrence relation. Now suppose and . Because there are no consecutive ’s, . Additionally because is periodic over , , so indeed satisfies the recurrence. Now consider the last case . Because there are no three consecutive ’s, this implies . Additionally and by assumption , so satisfies the recurrence. ∎
Recall from Theorem 3.3 that can never have a preperiod, so Theorem 3.5 completely characterizes all possible sequences for . We also note that instead of considering strings with and no subperiod, we can equivalently consider all with and allow for any subperiod of length . Define the sets
and . Sequences of this form can be generated iteratively by hand or by computer. For example, , , and
.
Theorem 3.5 proves that .
We can also provide an explicit enumeration of the possible sequences.
Theorem 3.6.
Let be the plastic constant and be the other two complex roots of , and let . Then the number of distinct sequences over all seeds is
(9) |
Proof.
To find a recurrence relation, we consider the four possible forms for the period structure to take, and how each can be reduced to a different form. We will then add the sequences which count each of these forms.
by removing the last two numbers | |||||
by removing the last number | |||||
by rotating one character left | |||||
by rotating one character right |
We note , so to follows that . This is a linear recurrence relation, meaning is a linear combination of the form , where , and are the roots of . We give initial conditions , , and .
To find the coefficients we compute that , so . Additionally, is real so . Finally, we know that , so . Therefore . ∎
is in the OEIS, known as the Perrin sequence [10, A001608].
3.1.1 Distinct Periodicities.
If we analyze , or equivalently , we find that all of the sequences ‘look like’ some form of or , with some initial shift that we call a ‘rotation’. This is true for many sequences, motivating a formal notion of similarity between period structures.
Definition 5.
We call two strings similar if they have a common subperiod, i.e. for , or if is some rotation of , i.e. and . We define to be the equivalence relation generated by these two criteria. We say and are distinct if .
Definition 6.
We denote as the set of equivalence classes of under . The length of a class is the length of its smallest element, i.e. the smallest subperiod of or the period length of .
Recall that is the set of all strings in with length , which is in bijection with . Therefore is the set of distinct periodicites in , so
(10) |
Definition 7.
We define to be set of distinct periodicities of with length . Similarly is the set of distinct periodicites in with length .
It follows that
(11) |
This implies that if and only if and , as means there is some non-periodic string with length and thus .
Example 3.7.
If we want to find the distinct periodicities of length three, six, and eight, we observe that , , and . In contrast, if we wish to know all distinct periodicites of , , and , we instead consult , , and .
It follows that because the periodicites of must have some length , we can enumerate by partitioning over period length. The following is a natural result of Equations 10 and 11.
(12) |
In the rest of this section we will enumerate the sets , , and for all . Recall that Theorem 3.6 gives .
Proposition 3.8.
Define
(13) |
where represents proper divisors of . Then the number of distinct periodicities of of length is , and the total number of distinct perioditicites is .
Proof.
We will show . First we consider all strings . In particular suppose has period , so and for some having no subperiod, i.e. . Because has no subperiod, it has different rotations and therefore representatives . Since can be any divisor of , we conclude / We can rearrange this to conclude as written in Equation 13. Note that we do not need a base case to compute explicitly because has no proper divisors. Equation 12 implies . ∎
Note that does not depend on , and in fact the set of distinct periodicities of length is equal for any as long as . The OEIS contains sequences [10, A113788] and [10, A127687], motivating an interesting bijection.
It is known that counts the maximal independent sets in vertex labeled cycles (see, for example, Example 1.2 in [7]). In 2007, Bisdorff et. al demonstrated that counts the number of unlabeled maximal independent sets of the cycle [5]. The correspondence between a binary sequence and a vertex set is simple; we include the vertex in exactly when . For example . The conditions for a string to be valid are equivalent to those for a maximal independent set. We cannot have two adjacent vertices of by independence, and cannot have two consecutive zeros by Theorem 3.5. We also cannot have three adjacent non-vertices in by maximality, or else we could add the middle vertex to . Similarly cannot have three consecutive ones. By our construction, it is clear that counts these sets in up to rotation, but not reflection. For example, the sequence because one cannot be rotated to the other, so they belong to different equivalence classes of . Thus, will count them both. However a reflection automorphism of would map the corresponding independent sets to each other. Moving forward, Table 1 shows the sequences , , and for .
3.2 Generalizing to
We will use a simple multiplicative permutation of to reduce every case to a version of . This will induce the strict structure of Theorem 3.5 on the seemingly complex periodicities of the case. We will generally assume that are coprime. If not, we can divide out and then find parallel copies of sequences for the coprime set using Multiplicative Linearity Proposition 2.7.
Definition 8.
Given some coprime, define the permutation by , where for all .
Because and are coprime, is a permutation of the string for all . This means is invertable, so it is a permutation of the collection .
Theorem 3.9 (Bijection).
Suppose with coprime and let . For any string with , let . Then if and only if .
Proof.
It suffices to show that obeys the recurrence relation if and only if does, as we could then use the seeds and respectively. Let be the multiplicative inverse of . This means , so . By leveraging the periodicity of and over , and noting that , we get
Therefore follows the recurrence relation of if and only if follows the recurrence relation of . ∎
Theorem 3.9 implies that the set of all period structures of can be obtained by applying the inverse permutation to each period structure of . Because is a permutation of , it bijects the set of all sequences with the set . In particular, we conclude precisely that if and are coprime, then
(14) |
or informally . Therefore Theorem 3.9 implies that we can generalize the results of Section 3.1.
Corollary 3.9.1.
Choose any , where . Then .
The power of follows from Linearity Proposition 2.7. Each of the independent parallel sequences for is equal to some game. Thus we can count -tuples of strings in to arrive at the total, which we formalize in Theorem 3.10. Next, we find that also bijects the classes of distinct periods.
Corollary 3.9.2.
Let be coprime and . Then is the number of distinct periodicities of length , and is the total number of distinct periodicities of .
Proof.
It suffices to show that preserves rotational symmetries and subperiods. Suppose some sequences and are rotated copies of each other, i.e. there is some such that for all . This implies , so and are rotated copies of each other with shift . Additionally, suppose has some subperiod, i.e. there is some such that . This implies is a rotated copy of itself, so indeed is a rotated copy of itself with shift , since and . We conclude that for all and , if and only if , so equivalence classes of are bijected by . ∎
If and are not coprime, it is more complicated to count the number of distinct periodicities, but we can use a generalization of Proposition 3.8.
Theorem 3.10.
Choose any , where . Define the following functions for all and :
(15) |
Then is the number of distinct periodicities of with length , and is the total number of distinct periodicities of .
Proof.
First we will justify that the total number of strings in which are periodic over is , not considering similarity under . Denote this set by . Let . We know by Theorem 3.3 that is always periodic over , so for all , for some with . Using Linearity Proposition 2.7, we can write as a collection of parallel strings for where , and for all , . Additionally, for each , must satisfy the recurrence relation for . Suppose that is also periodic over length , so . Using the division algorithm let , where and . Additionally, let and . We will prove that the following conditions are sufficient and necessary for this to occur.
-
(i)
For all , and all ,
-
(ii)
For all and all ,
We first show necessity. Assuming is periodic over length , this means for all , we have
This proves stronger versions of (i) and (ii).
Next, we show sufficiency. Assume (i) and (ii) hold. For any , use the division algorithm to get . We hope to show that . Suppose that . Then by condition (ii),
(16) |
Alternately, suppose that , and consider the set of indices , taken modulo . We denote these for . Because , this means for all . Additionally, we know that the order of in the group is , which means that for . This means that only can be in the set and for all we must have .
Now, let , and consider the sequence of values . We know that by condition (i). We also observe that for all , we have for some . Because we know , Equation 16 implies that . Therefore
Therefore we have shown that conditions (i) and (ii) are equivalent to being periodic over length , and we now enumerate the strings satisfying these conditions. To satisfy (i) we may choose any -tuple of sequences in which are periodic over for . To satisfy (ii) we must let be the appropriate translations of these sequences, so they are fixed. Thus we find the total number of possibilities .
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2 | 3 | 2 | 5 | 5 | 7 | 10 | 12 | 17 | 22 | 29 | 39 | 51 | 68 | 90 | 119 | 158 | 209 | 277 | |
0 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 3 | 3 | 4 | 5 | 7 | 8 | 11 | 13 | |
0 | 1 | 1 | 1 | 1 | 2 | 1 | 2 | 2 | 3 | 2 | 4 | 3 | 5 | 6 | 7 | 7 | 11 | 11 | 16 |
In the simpler case when are coprime, refer to the sequences and in Table 1. As a result of the general enumeration we find that for all , exactly when or or . Thus
We also see that for any coprime and any , there is at most one distinct periodicity of and of length over all . Given some for , the two periodicites of length are . This means that for any , with , the two periodicities are and .
Example 3.11.
Consider the set . There are periodicites, where exactly have period . First we write the 5 periodicities of , given by
Next, we permute these strings. , so we compute . For the first string:
This yields . Repeating this procedure, we get the following:
Note that the period lengths of , , and are conserved under the permutation, as shown in Corollary 3.9.2. This procedure yields all 5 periodicites of .
The asympotic behavior of these functions is generally well behaved. Because , where and are the non-real roots of , we have the convergence .333For all , we have the exact equality . For the following analysis, let with , and assume that , which excludes relatively few sets. Then . The set of seeds has cardinality . Because this means that the set of seeds grows faster than the sequences they generate, the number of seeds converging to the same sequence grows exponentially as increases. This approximation of also implies that and . We can can also derive , giving a strong estimation of the of the number of possible period structures for large .
4 The case
Analogously to Section 3.1, a good starting point for understanding the game is the game. This case was studied by Ho in [9, sec. 2], where he solves the game for . We provide a full analysis by constructing for all and with no seed, where most importantly we specify the existence and structure of preperiods.
For the remainder of the paper we will use to define as the least non negative remainder of modulo .
Theorem 4.1.
Suppose we have some , and let . Denote , . This means . Additionally let and ; we will only use these when they take on integer values.
Case | Conditions | |||
---|---|---|---|---|
i | odd, | |||
ii | odd, even, | |||
iii | even, | |||
iv | even, | |||
v | even, odd | |||
vi | even, | | ||
vii | even, , even, | Equation 17 | ||
viii | even, , even, | Equation 17 | ||
ix | even, , even, | Equation 17 |

The last three cases yield the most interesting results, providing an exact specification of the existence and structure of preperiods. These can be visualized in Figures 1 and 2.
Proof (i).
If and are odd, then they are both extensions of as in Example 2.11, so . ∎
Proof (ii).
Suppose is odd and is even. For , , so , and therefore , because is an extension of . Thus Now for all , we find that and . Therefore if is odd, then is even so and therefore . If is even then is even so and therefore . Thus:
Because , Corollary 2.12.2 of the translating zeros lemma implies that this is the entire period with no preperiod.
∎
Proof (iii).
Suppose and . For we have a single period of , specifically Next, for , we find that and . If is odd, then is even so and thus . If is even, then is even so and thus . This yields . Because , this is the entire period with no preperiod, as implied by Lemma 2.13. ∎
Proof (iv).
Suppose and . Then is an extension of by Proposition 2.10, so . ∎
Proof (v).
Suppose and is odd. As above, for the first elements of the sequence, is equal to .
Now let for . This means that and . If is odd, then is odd so , so . If is even, then and and , so . This extends the sequence to
We just showed , so .
Now let for . If is odd, then , which has an even remainder less than , so and therefore . If is even, then , which is even and less than , so and therefore . We then extend the sequence.
Because , we may again apply Corollary 2.12.2 to claim that this is the complete period with no preperiod.
Note that if , this solution still works and has sub-period , which agrees with (iv). ∎

Proof (vi, vii, viii, ix).
Assume , is even, and , and recall . All four of the remaining cases are expressed in the following equation. Interestingly, the preperiod structure is the same for all cases.
(17) |
A proof of this Equation is given in Subsection 4.1. We simply check that the recurrence relation is satisfied.
In case (vi) where , this means so the summation is empty and there is no preperiod. Because we assume , this falls into the case of Equation 17, which has length .
In the remaining cases both and are nonzero, and each term in the preperiod summation has length
Examine the last values of the last term in the summation, . If , this is , which is equal to the last values of the period structure. If , this is equal to , which is also equal to the last values of the period structure. This implies that the preperiod transitions into the period steps earlier than depicted in Equation 17, and has length .
In cases (vii) and (viii), can be computed simply by counting the length of the strings in Equation 17. The period for has length
The period for has length
In case (ix), where , recall that . This allows us to simplify , so the two period structures are equivalent and can be expressed as , which has period .
We might also notice that Equation 17 also holds if (with no preperiod) and agrees with case (iv). In this case we would have so and . ∎
One result of this is that preperiod lengths can be arbitrarily longer than periods in the case. This can be seen in Figure 2, where the preperiod length appears quadratic in .
Example 4.2.
Let and . Then . This means , , and . Noting that , Equation 17 yields
(18) |
and Theorem 4.1 (case vii) gives , and .
If we instead choose and , we would have (case ix) so and .
For general 3-sets, Althöfer and Bülterman [1, problem (vi)] provided the example with , though they err in giving for while actually for all . Another example follows from [6, thm 2]. If , then and . Thus for general -sets, is not bounded by any function of , whereas for , Theorem 4.1 shows that .
In Section 3, we used the case to characterize all possible -sets using a permutation of . A similar strategy may be possible if we could characterize all periodicities of , though this would be more complicated. In particular, note that the length of the periods are highly dependent on seeds, unlike the case. An example of this is proven in Section 6 and visualized in Figure 7.
Suppose and we are given any string with . If , then we let be the multiplicative inverse of in and and . We see is a permutation of , so we could show in a manner similar to Theorem 3.9 that if and only if . Thus as long as and are coprime, we have . This observation carries little information without further understanding of .
As an example we apply Lemma 6.1. Choose any and . Let and let . Lemma 6.1 will imply that . 2 is coprime to , so calculate that and , and finally . Therefore there is some seed such that .
4.1 Building the preperiod sequence for
The statements in Theorems 4.1, 5.1, and Lemma 6.1 are somewhat tedious, so we provide three proofs of distinct flavors. In this section we provide a visual verification of Equation 17 to complete the proof of Theorem 4.1.
Proof.
We claim that if , , is even , and , then Equation 17 holds.
To verify the construction of the preperiod, we will confirm that for each term , the recurrence relation holds. If , note that the first entries proceed as , so , which agrees with the term of Equation 17. Thus when considering prefixes we may assume . Suppose the term starts at entry , and assume that the previous terms follow Equation 17.
The “alignment diagram” on the left hand side in Figure 3 re-writes the structure presented in Equation 17 on two lines such that on the first line is horizontally justified with on the second line. To interpret this diagram, we simply confirm that for all , if , then then look directly below to check that . Further, if , then either on the left, or directly below (shown in bold), or neither is true and we must have (underlined).
Consider the additional case where and . The diagram nearly holds until the last entries. In particular, we note that , so the sequence should conclude with instead of . Therefore the term can be modified to
.
The alignment diagram on the right hand side in Figure 3 similarly re-writes the structure such that is horizontally justified with . We must confirm that if , then directly below, . We also confirm that the underlined entry has .
Therefore for all , the term follows the recurrence. Note that the does not affect the recurrence, but represents that the value is unknown. This value is if but if . In either case, the recurrence holds. Now we consider the case. As justified above, after the term, the term begins at index with
We now observe that for , the sequence satisfies the recurrence. Because has length , it suffices to check that if and only if or or . satisfies this criterion by inspection.
Now consider the case. As justified above, after the term, the term begins at index with
Now, we show that for , the sequence satisfies the recurrence using alignment diagrams. Note that , and we start the diagram at to simplify the diagram.
Similarly checking the recurrence for :
These diagrams verify that satisfies the recurrence, and this completes the proof that Equation 17 holds. ∎
5 The case
In [4, p. 531], Berlekamp et. al state without proof that the period lengths of the game are quadratic and give a formula for the period length of the Grundy sequence . In [1], Althöfer and Bülterman prove a particular example of this case (Example 5.2). In this section we provide a proof for the general game by finding explicitly, which was presented as open by Ho in [9, table 4].
Theorem 5.1.
Suppose with . Define , , and , with the exception .444This means if and if not. Let . Then
(19) |
It follows that
(20) |

Berlekamp et. al [4, p. 531] inspire an alternate formulation of Equation 20. If we let for , then the following also holds:
Proof.
We separate this proof into cases, beginning with the simpler linear case.
Case 1: If or , we can let for odd and .
For we find , and . Because is odd,
Next, for all , we see that if then both and . This fills in the next portion of the sequence; we use underline and bold characters to highlight the structure of the recurrence.
We now observe that , which proves that with no preperiod. We now move to the quadratic case.
Case 2: If , then we will have , for and . Again for , the sequence is identical to .
Once again for , we notice that if , then by the recurrence . This means that for all , we have , as illustrated in the equation below. This leaves a gap of length . In this gap , we find , so indeed .
Because we showed has , this implies , so we may append ’s after .
This completes the first term in the summation, where and . Using this as a base case for induction, we now show that the term in the summation succeeds the term. Suppose
We need only consider recent values of back to , so define the index such that
Now let and notice that ends with a long string of ones.
In particular we find that for all , we have and , so proceeds identically to for a length of precisely . We must now consider sub-cases for parity, where or . We show the two cases below
Note that in the two cases we can plug in and respectively. In the second case, where , then for , we find so . For , we find , so . Extend this second case below, defining as the frontier of the sequence:
This adds another copy of to the sequence in the second case, and observe that in the first case and in the second. We can therefore combine cases. Additionally, we find that for , if then . This leads to another string of with a gap of length which is filled with zeros. This is shown below, where ,
For , we see so . This completes the inductive step as we show below:
By induction this pattern will repeat. Let , which is the order of in . Thus the iteration is the first such that and so the sequence is
(21) |
We see that , so this is the entire period. We see that the term of the summation has length , and there are total terms. We also compute that is the number of terms for which , so if we include the first term and exclude the last term , there are precisely terms in the summation where , and the rest have . Therefore . We conclude that the total period length is
The following example is given as a Theorem in [1].
-------------1111111111111---11111111111111111111111111111----------1111111111111 ------11111111111111111111111111111-------1111111111111 ---------11111111111111111111111111111----1111111111111 ------------11111111111111111111111111111-1111111111111 -------------1111111111111--11111111111111111111111111111-----------1111111111111 -----11111111111111111111111111111--------1111111111111 --------11111111111111111111111111111-----1111111111111 -----------11111111111111111111111111111--1111111111111 -------------1111111111111-11111111111111111111111111111------------1111111111111 ----11111111111111111111111111111---------1111111111111 -------11111111111111111111111111111------1111111111111 ----------11111111111111111111111111111---1111111111111 -------------111111111111111111111111111111111111111111
Example 5.2.
This class of sets appears to be the only case for which can have superlinear period lengths with no seed. Further generalizations using this result and Theorem 4.1 might bring the following conjecture within reach.
Conjecture 1.
For all such that ,
(22) |
We have verified Conjecture 1 computationally for all . If this conjecture is true, it must relate in part to some invariant of the structure caused by the initial seed of , because it fails entirely for different seeds, even if and are coprime. This invariant would therefore be carried through the quadratic length preperiods seen in Section 4.

6 Super-polynomial Period lengths with initial Seeds.
In this section we consider a particular family of sets which demonstrate that super-polynomial period lengths exist for 3-sets, given properly chosen initial seeds. This family will relate to an intersection of the cases of Sections 4 and 5.
Lemma 6.1.
For any , choose some odd and let and . Then and .
A proof of this Lemma is found in Section 6.1. If we denote , where , then the structure of the periodicity is exactly
To choose a seed generating this structure it suffices to choose any sub-string of length , so we choose the first entries, namely . Lemma 6.1 contradicts the generalization of Conjecture 1 over all seeds, since it implies quadratic period lengths. Figure 7 plots all period lengths for , which shows that this Lemma only scratches the surface of the periodicities of -sets.

, while Lemma 6.1 gives only
.
Theorem 6.2 (Superpolynomial Period Lengths).
For , define , , and . For the family of pairs , where , it holds that
Proof.
Fix , so we have and . We now construct the seed dependent on . Because has greatest common divisor , let and apply Multiplicative Linearity Proposition 2.7 to see that the parallel sequences satisfy where for . We now apply Lemma 6.1 by letting , so we have . By combining all in parallel, this construction yields . Now, suppose is periodic over some . This implies that for all and , we have
so must also be periodic over , i.e. . Because this is true for all , we conclude that . A result from [2, Problem 10797] regarding the lcm of arithmetic progressions implies a somewhat loose bound of .555In particular it says that with the summation taken over units of . This is an average of numbers greater than . Therefore for all , we note that , and conclude . ∎
Table 2 demonstrates the construction for . This family proceeds as follows
-
•
, , , , and
-
•
, , , ,
-
•
, , , ,
-
•
, , , ,
-
•
, , , , and ; we have not computed the exact period.
It is natural to predict that we have a multiple of in the period length, but we have not proven this to be the case. To prove Theorem 6.2 we used a rough bound on and the few periodicities from Lemma 6.1, as shown in Figure 7. It is unclear if more periodicities and a stronger bound on their , would yield an asymptotically better result, but this does not appear to be the case. Figure 8 shows that appears to be best possible.

1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | … | ||||||||||||
0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | … |
6.1 Proof of Lemma 6.1.
The final proof uses different approach to the previous ones. Rather than constructing the sequence from scratch, we will exploit a structural pattern to extend a simple period. This was the method used to discover Lemma 6.1, and might be a productive strategy moving forward.
Proof.
First, we note that if , then Theorems 4.1 and 5.1 coincide to give that with no seed, so we are done. Next, fix .
Observe that if and then the string is a valid period structure of with period length . This follows from the fact that if and only if , , or , meaning each zero is separated by or ones. We use this fact to explicitly build period structures for odd .
Write copies of in a grid so that the rows are the following: The even row indexed from zero reads and the odd row reads , except for the last row, (the odd row), and this reads . Table 3 gives two examples of such a filling. Notice that this filling has the following three properties.
-
•
Reading across all of the rows yields in order.
-
•
Even rows are fully filled. These begin and end with strings or . Their length is so they contain all of except for a .
-
•
Odd rows have entries, except for row which has entries. These begin and end with , and contain all of except either or .
1 | 1 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 0 | ||
1 | 1 | 1 | 0 | 1 | 1 |
0 | 1 | 1 | 1 | 0 |
1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | ||
1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 |
0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | ||
1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 |
Denote as the element in row and column , both indexed from . We can now re-interpret the recurrence relation on in terms of . The following identities must hold for all .
(23) |
We focus on the first two cases which are the most general. It might also help to recall that for odd , and for even , . These follow from the specifications of the grid filling.
Next, we will choose any odd for , and let . We will extend the grid to create a period structure for with length . We add copies of the first two columns on the left side, as shown below.
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 |
0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | ||
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 0 |
= (11)d+1 0 1 1 1 (01)d+1 1 0 (11)d+1 1 0 1 1 (01)d+1 1 1 0
We call the elements of this modified grid , with indexed from and indexed from . Thus for we have . If is even we have and if is odd we have . Because of the specifications for filling , we note that this entails prepending to even rows and to odd rows.
Claim. Reading across the rows of this table yields , a valid period structure for with length . First we have added entries to the table, and we started with , so the total length is
Next we show that the recurrence relation is satisfied. To do this, write the recurrence relation in terms of . The rows are extended by the same length as the recurrence, so the following rules very are similar to Equation 23.
(24) |
From here it is possible to check that the nine cases in Equation 24 hold for all and using Equation 23, the definition of and the three properties of the filling. We will show only the two main cases; the rest follow suit.
If is odd and , then we confirm
If is odd and is even, then we know , so we confirm
If is odd and is odd, then we know , so we confirm
If is even and , then
If is even and is odd, then we know , so we confirm
If is even and is even, then we know , so we confirm
Such verification can be completed for the seven edge cases to show that obeys Equation 24, and therefore .
Finally, we check for subperiods of . Note that as long as , there are exactly copies of the substring present in , each at the beginning of a row. Additionally, the last row uniquely has length , meaning the instances of are unequally spaced throughout . This prevents a sub-period of from occurring. ∎
7 Closing
We close the paper by setting up a few conjectures. First, we recall the observation that the converse of Proposition 2.10 holds for all where , and state it explicitly in a conjecture.
Conjecture 2.
If , then for all , let . Then if is an extension of for all and , then .
It suffices to check the case . If this is precisely the converse of Proposition 2.10; otherwise the converse is not true.
The following conjecture is based on computer simulations of . It provides a very limited characterization of the general case but provides an example of its complex behavior.
Conjecture 3.
Suppose with . Use the division algorithm to obtain the following variables:
Then and if and only if one of the following holds:
-
(i)
is even and , , and , and if then .
-
(ii)
is odd and , , and if then .
-
(iii)
is odd and , and
The following conjecture has been verified for all , for all seeds . Together with Conjecture 1 these are a strengthening of a conjecture by Althöfer and Bültermann in [1, (i)].
Conjecture 4.
If with , and if , then for all seeds , we have .
Acknowledgement
IM was supported by NKFIH grant K132696. The project is a continuation of the work done at the 2022 Spring semester at Budapest Semesters in Mathematics. Both authors thank to Mariam Wael Abu-Adas for participating in the very early phase of the research work at the BSM leading to the results presented in this paper. Both authors would like to thank the BSM for running the program.
References
- [1] Ingo Althöfer and Jörg Bültermann. Superlinear period lengths in some subtraction games. Theoretical Computer Science, 148(1):111–119, 1995.
- [2] P. T. Bateman, Jeffrey Kalb, and Allen Stenger. A limit involving least common multiples: 10797. Am. Math. Mon., 109:393–394, 2002.
- [3] Elwyn R Berlekamp, John H Conway, and Richard K Guy. Winning ways for your Mathematical Plays, volume 1. AK Peters, 2001.
- [4] Elwyn R Berlekamp, John H Conway, and Richard K Guy. Winning ways for your Mathematical Plays, volume 3. AK Peters/CRC Press, 2004.
- [5] Raymond Bisdorff and Jean-Luc Marichal. Counting non-isomorphic maximal independent sets of the n-cycle graph. Journal of Integer Sequences, 11, 02 2007.
- [6] Grant Cairns and Nhan Bao Ho. Ultimately bipartite subtraction games. Australas. J Comb., 48:213–220, 2010.
- [7] Zoltán Füredi. The number of maximal independent sets in connected graphs. J. Graph Theory, 11(4):463–470, 1987.
- [8] P. M. Grundy. Mathematics and games. Eureka, 2:6–8, 1939.
- [9] Nhan Bao Ho. On the expansion of three-element subtraction sets. Theoretical Computer Science, 582:35–47, 2015.
- [10] OEIS Foundation Inc. The On-Line Encyclopedia of Integer Sequences, 2023. Published electronically at http://oeis.org.
- [11] R. P. Sprague. Über mathematische kampfspiele. Tohoku Mathematical Journal (in German), 41:438–444, 1936.