Faster Evaluation of Subtraction Games
FFaster Evaluation of Subtraction Games
David Eppstein Computer Science Department, University of California, [email protected]
Abstract
Subtraction games are played with one or more heaps of tokens, with players taking turns re-moving from a single heap a number of tokens belonging to a specified subtraction set ; the lastplayer to move wins. We describe how to compute the set of winning heap sizes in single-heapsubtraction games (for an input consisting of the subtraction set and maximum heap size n ),in time ˜ O ( n ), where the ˜ O elides logarithmic factors. For multi-heap games, the optimal gameplay is determined by the nim-value of each heap; we describe how to compute the nim-values ofall heaps of size up to n in time ˜ O ( mn ), where m is the maximum nim-value occurring amongthese heap sizes. These time bounds improve naive dynamic programming algorithms with time O ( n | S | ), because m ≤ | S | for all such games. We apply these results to the game of subtract-a-square, whose set of winning positions is a maximal square-difference-free set of a type studied innumber theory in connection with the Furstenberg–Sárközy theorem. We provide experimentalevidence that, for this game, the set of winning positions has a density comparable to that ofthe densest known square-difference-free sets, and has a modular structure related to the knownconstructions for these dense sets. Additionally, this game’s nim-values are (experimentally) sig-nificantly smaller than the size of its subtraction set, implying that our algorithm achieves apolynomial speedup over dynamic programming. Theory of computation → Design and analysis of algorithms
Keywords and phrases subtraction games, Sprague–Grundy theory, nim-values
Digital Object Identifier
Subtraction games were made famous by the French film
L’Année dernière à Marienbad (1961), which showed repeated scenes of two men playing Nim. A subtraction game isplayed by two players, with some heaps of game tokens (such as coins, stones, or, in thefilm, matchsticks) between them. On each turn, a player may take away a number of tokensfrom a single heap. The tokens removed in each turn are discarded, and play continues untilall the tokens are gone. Under the normal winning convention , the last player to move isthe winner [2]. In Nim, any number of tokens may be removed in a turn. This game hasa simple analysis according to which it is a winning move to make the bitwise exclusive-orof the binary representations of the heap sizes become zero. If this bitwise exclusive-or isalready zero, the player who just moved already has a winning position [4]. However, othersubtraction games require the number of removed tokens to belong to a predetermined set ofnumbers, the subtraction set of the game. Different subtraction sets lead to different gameswith different strategies. Supported in part by NSF grants CCF-1618301 and CCF-1616248. Golomb [7] has considered an even more general class of games, in which the subtraction set specifiescombinations of numbers of tokens that may be simultaneously removed from each pile. © David Eppstein;licensed under Creative Commons License CC-BY9th International Conference on Fun with Algorithms (FUN 2018).Editors: Hiro Ito, Stefano Leonardi, Linda Pagli, and Giuseppe Prencipe; Article No. 20; pp. 20:1–20:12Leibniz International Proceedings in InformaticsSchloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany a r X i v : . [ c s . D S ] A p r All subtraction games are impartial , meaning that the choice of moves on each turn doesnot depend on who is making the move. As such, with the normal winning convention, thesegames can be analyzed by the Sprague–Grundy theory, according to which each heap oftokens in a subtraction game has a nim-value , the size of an equivalent heap in the game ofNim [4, 8, 17]. The optimal play in any such game is to move to make the bitwise exclusive-orof the nim-values zero. The winning positions are the ones in which this bitwise exclusive-oris already zero. Unlike Nim itself, positions with a single nonempty heap of tokens maybe winning for the player who just moved; this is true when the nim-value of the heap iszero. The heap sizes whose nim-values are zero are called “cold”, while the remaining heapsizes are called “hot”. In a game with a single heap of tokens, it is a winning move to takea number of tokens such that the remaining tokens form a cold position. If the position isalready cold, the player who just moved already has a winning position, because the playerto move must move to a hot position.Every finite subtraction set leads to a game with periodic nim-values (depending only onthe sizes of the heaps modulo a fixed number). Some natural choices of infinite subtractionset, such as the prime numbers, also do not lead to interesting subtraction games [7]. However,a more complicated subtraction game, “subtract-a-square”, has the square numbers as itssubtraction set. That is, on each move, each player may remove any square number oftokens from any single heap of tokens. The game of subtract-a-square was studied in 1966by Golomb [7], who calls it “remarkably complex”; Golomb credits its invention to RichardA. Epstein. Its sequence of nim-values,0 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . . . (sequence A014586 in the Online Encyclopedia of Integer Sequences, OEIS) displays noobvious patterns.Subtract-a-square has another reason for interest, beyond investigations related to combi-natorial game theory. The set C of cold positions in this game,0 , , , , , , , , , , , , , , , , , , , , , . . . (sequence A030193 in the OEIS) has the property that no two elements of C differ by asquare number. A sequence with this property is called a square-difference-free set. Thecold positions of subtract-a-square are square-difference-free because, whenever c is a coldposition, and i is a positive integer, c + i must be hot, as one could win by moving from c + i to c . The square-difference-free sets have been extensively investigated in numbertheory, following the work of Furstenberg [6] and Sárközy [14], who showed that they havenatural density zero. This means that, for all (cid:15) , there exists an N such that, for all n > N ,the fraction of positive integers up to n that belong to the set is at most (cid:15) .More strongly, the set C of cold positions in subtract-a-square is a maximal square-difference-free set. Every positive integer that is not in C (a hot position) has a move to acold position, so it could not be added to C without destroying the square-difference-freeproperty. Every maximal square-difference-free subset of the range [0 , n ] must have size atleast Ω( √ n ) (otherwise there would not be enough sums or differences of set elements andsquares to prevent the addition of another number in this range) and size at most O (cid:18) n (log n ) log log log log n (cid:19) No relation. See Golomb [7], Theorem 4.1. avid Eppstein 20:3 by quantitative forms of the Furstenberg–Sárközy theorem [12]. In particular, these boundsapply to | C ∩ [0 , n ] | , the number of cold positions of subtract-a-square up to n . However, itis not known whether these upper and lower bounds are tight or where the number of coldpositions lies with respect to them. In the densest known maximal square-difference-free sets,the number of elements up to n isΩ (cid:16) n (1+log / (cid:17) ≈ n . . The construction for these dense sets involves finding a square-difference-free set modulo somebase b , and selecting the numbers whose base- b representation has these values in its evendigit positions and arbitrary values in its odd digit positions [13]. The bound given in theformula above comes from applying this method to a square-difference-free set of 12 valuesmodulo 205 [1, 10]. Plausibly, a greater understanding of the nim-values of subtract-a-squarecould lead to progress in this area of number theory.Algorithmically, for a subtraction game in which the allowed moves are to take a numberof tokens in a given set S , the nim-values can be computed by dynamic programming, usingthe recurrencenimvalue( n ) = mex i ∈ S,i ≤ n nimvalue( n − i ) . Here, the “mex” operator (short for “minimum excludent” [4]) returns the smallest non-negative integer that cannot be represented by an expression of the given form. No separatebase case is needed, because in the base case (when n = 0), the set of available moves(numbers in S that are at most n ) is empty and the mex of an empty set of choices is zero.Evaluating this recurrence, for all heap sizes up to a given threshold n , takes time O ( n | S | ).The set C of cold positions can be determined within the same time bound, by applying thisrecurrence and then returning the set of positions whose nim-value is zero.However, in the study of algorithms, many naive dynamic programming algorithms turnout to be suboptimal: they can be improved by more sophisticated algorithms for the sameproblem. Is that the case for this one? We will see that it is. We provide the following tworesults:We show how to compute the set of cold positions in a given subtraction game, for heapsof size up to a given threshold n , in time ˜ O ( n ).We show how to compute the nim-values of a given subtraction game, for heaps of sizeup to a given threshold n , in time ˜ O ( mn ).In these time bounds, the ˜ O notation elides logarithmic factors in the time bound, and theparameter m refers to the maximum nim-value of any position within the given range.Ignoring the logarithmic factors hidden in the ˜ O notation, our time bounds are alwaysat least as good as the O ( n | S | ) time for naive dynamic programming, because for anysubtraction game m ≤ | S | (if there are only | S | possible moves, the mex of their values canbe at most m ). But are they actually a significant improvement? To answer this, we need toknow how quickly m grows compared to the known growth rate of | S | .To determine whether our algorithms provide a speedup for the game of subtract-a-square,we performed a sequence of computational experiments to determine the density of thisgame’s cold positions and the growth rate of its largest nim-values. We find experimentallythat, up to a given n , the largest nim-value appears to grow as O ( n . ), significantly moreslowly than the O ( n / ) growth rate of the subtraction set. The difference in the growthrates for these quantities shows that our algorithms are indeed an asymptotic improvementby a polynomial factor. Additionally, the number of cold positions appears to grow at least F U N 2 0 1 8 as quickly as n . . That is, the cold positions of this game provide an unexpectedly largesquare-difference-free set, competitive with the best theoretical constructions for these sets.Examining the modular structure of the set of cold positions, we find that it appears to besimilar to the structure of these theoretical constructions, with a square-difference-free set ofdigit values in even positions and arbitrary values in odd positions. In order to evaluate subtraction games efficiently, it will be convenient to generalize themsomewhat, to a class of subtraction games with hotspots . Given two sets S and H (of positiveand non-negative integers respectively), we define a subtraction game with subtraction set S and hotspot set H as follows. The game starts with a single pile of some number of tokens,and the players alternate in choosing a number from S and removing that number of tokensfrom the pile, as before. However, if any move leaves a pile whose remaining number oftokens belongs to H , then the player who made that move immediately loses. (This is notquite the same as allowing the other player to remove all the tokens from piles whose sizebelongs to H , because H might contain the number zero, in which case removing all thetokens could be a losing move instead of a winning move.)The presence of these hotspots makes defining a nim-value for these games problematic:they are not played by the normal winning convention, so what would happen if we played agame with multiple piles and one player moved to a hotspot? Nevertheless, a recurrence ofthe usual form suffices to determine the set of hot and cold positions of such a game:hot( n ) = n ∈ H ∨ _ i ∈ S,i ≤ n ¬ hot( n − i ) . In a subtraction game (with subtraction set S , with or without hotspots), suppose that someset C of positions has already been determined to be cold. Then all positions H that canreach C in a single move are automatically hot. We can formulate membership in this set ofhot positions as a Boolean formula in conjunctive normal form (2-CNF):( i ∈ H ) ⇐⇒ _ j + k = i ( j ∈ C ) ∧ ( k ∈ S ) . Now suppose that C and S are both represented as bitvectors: arrays of binary valuesthat are 0 for non-members and 1 for members of each set. Then the problem of computingthe bitvector representation of H from the above formula is a standard problem known as Boolean convolution , studied for its applications in string matching [5, 9, 11]. It is an instanceof a more general class of convolution problems in which we compute C [ i ] = ⊕ j + k = i A [ j ] ⊗ B [ j ]for an “addition” operation ⊕ and “multiplication” operation ⊗ . In Boolean convolution, ⊗ is conjunction ( ∧ ), and ⊕ is disjunction ( ∨ ).If the input bitvectors have total length n , their Boolean convolution can be computed in O ( n log n ) time by replacing their Boolean values with the numbers 0 and 1 and computinga numerical convolution (with addition as ⊕ and multiplication as ⊗ ) using the fast Fouriertransform algorithm. avid Eppstein 20:5 We are now ready to describe our algorithm for finding the hot and cold positions of asubtraction game with hotspots. We assume that we are given as input a range [ x, y ) ofinteger values to evaluate (following the Python convention for half-open integer rangeswhere the bottom delimiter is inside the range and the top delimiter is outside it), togetherwith two sets: the subtraction set S and a set H of predetermined hotspots.As a base case, if the range has zero or one values in it, we can solve the problem directly:each value in the range is hot or cold accordingly as it belongs or does not belong to H ,respectively. Otherwise, we perform the following steps: Find the midpoint m = ( x + y ) / x, m ) and [ m, y ). Recursively evaluate the lower subrange [ x, m ), determining its hot and cold positions( H x and C x respectively). Use Boolean convolution to find the positions H m in the upper subrange [ m, y ) that arehot because they can be reached in a single step from a cold position C x in the lowersubrange. Recursively evaluate the upper subrange [ m, y ), with hotspot set H ∪ H m , determiningits hot and cold positions ( H y and C y respectively). Return the hot set H x ∪ H y and cold set C x ∪ C y .The time for this algorithm can be analyzed using the master method, as is standard forsuch divide-and-conquer algorithms, giving the following result: (cid:73) Theorem 1.
We can determine which positions are hot and which are cold, in a range of n positions of a subtraction game with hotspots, in time O ( n log n ) . We can reduce the computation of nim-values in a subtraction game to the computation ofhot and cold positions in a subtraction game with hotspots, via the following lemma. (cid:73)
Lemma 2.
Let S be a subtraction set, and let H be the set of positions in the subtractiongame for S that have nim-value at most t . Then the positions that have nim-value t + 1 areexactly the cold positions of the subtraction game with hotspots with subtraction set S andhotspot set H . Proof.
A position has nim-value t + 1 if it does not belong to H (else it would have a smallernim-value) and does not have a move to a smaller position with nim-value t + 1 (else t + 1would not be one of its excluded values). But this is exactly the defining condition for thecold positions of the subtraction game with hotspots. (cid:74)(cid:73) Theorem 3.
In any subtraction game with subtraction set S , we can determine the nim-values of the first n positions in time O ( mn log n ) , where m is the maximum nim-value ofany of these positions. Proof.
We loop over the range of nim-values from 0 to s , using Theorem 2 to compute theset of positions having each successive nim-value in time O ( n log n ) per nim-value. Theloop terminates when all of the first n positions have been assigned a nim-value. (cid:74) The maximum nim-value of a subtraction game is | S | , so (except for the logarithmicfactors) this time bound compares favorably with a naive O ( n | S | ) dynamic programmingalgorithm for computing the nim-values of each position by finding the minimum excludedvalue among the other positions reachable from it. F U N 2 0 1 8 l l lll l l llllllllll lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll log2 n l og2 m a x n i m − v a l ue m = 1.3251885340723 * n**0.350735691549274 Figure 1
The maximum nim-values m seen among the first n positions in subtract-a-square. To compare the performance of our Boolean convolution based evaluation algorithms to naivealgorithms for subtract-a-square, we performed some computational experiments, which wedescribe here.
Figure 1 plots (on a doubly logarithmic scale) the maximum nim-values m seen among thefirst n positions in subtract-a-square. Only the positions where a new maximum is attainedare included in the plot.We fitted a function of the form cn e (a monomial with constant coefficient c and exponent e ) to these points, by using Siegel’s repeated median estimator [16], a form of robust statisticalregression that is insensitive to outliers (as would be expected to occur in the lower leftparts of the plot). This estimator fits a line through a sample of points by, for each point,computing the median of the slopes formed by it and the other points, and then choosingthe slope of the fit line to be the median of these medians. It similarly chooses the height ofthe fit line so that it passes above and below an equal number of points. We applied this tothe points on our log-log plot, using the mblm library of the R statistical package, whichimplements this estimator, and then transformed the fit line back to a monomial over the avid Eppstein 20:7 l l l l l l l llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll log2 n l og2 c o l d c = 0.897244337916743 * n**0.698354314248528 Figure 2
The number of cold positions among the first n positions in subtract-a-square. original coordinates of the data points. The result is shown in red in the figure.As the figure shows, the maximum nim-value m among the first n positions of subtract-a-square is accurately estimated by a function of the form O ( n . ), well below the O ( n . )size of the subtraction set for this game. Therefore, we would expect our O ( mn log n )-timeconvolution-based algorithm for computing the nim-values of this game to be asymptoticallyfaster than the O ( n / ) time for dynamic programming. However, even if we ignore thedifferent constant factors in the running times of these two algorithms, n needs to beapproximately 10 in order for n . log n to be smaller than n . , so we would not expectthis speedup to be applicable to practically relevant ranges of n . Because of the simplicityand relative efficiency of the dynamic programming algorithm for small n , the values inFigure 1 (for n up to 2 ) were computed by dynamic programming rather than convolution. Our next experiment measures the number of cold positions among the first n positions insubtract-a-square (Figure 2). In order to provide more data points in the lower left part ofthe log-log plot than would be visible if we used uniform sampling of the range of valuesof n , the plot of Figure 2 shows the number of cold positions for each value of n that is aperfect cube (that is, for the values 1 , , , , . . . ) up to 2 . As in the previous experiment, F U N 2 0 1 8 we fitted a monomial function to these points using Siegel’s repeated median estimator.The number of cold positions does not directly affect the time bound for our convolution-based algorithm. However, it does affect the time for a different algorithm, for computingthe set of cold positions (but not their nim-values) directly, in any subtraction game. Thisalgorithm is analogous to the sieve of Eratosthenes, which finds prime numbers iteratively,for each one marking off the numbers that are not prime. To compute the cold positionsamong the first n positions, it performs the following steps: Initialize a Boolean array H of length n (indicating whether each position is hot) to befalse in each cell. For each position i from 0 to n , test whether H [ i ] is still false. If it is, perform thefollowing steps: a. Output i as one of the cold positions. b. For each value s in the subtraction set S , mark i + s as hot by setting H [ i + s ] to betrue.If the set of cold positions up to n is C , and the subtraction set is S , then this sievingalgorithm takes time O ( | C | · | S | ).In some subtraction games, C could be as small as n/ | S | , in which case the sievingalgorithm would take linear time. However, our experiments show that, for subtract-a-square, C appears to grow more like n . , giving the sieving algorithm a running time of approximately n . , compared to the O ( n log n ) time bound of the convolution based algorithm. Againignoring the constant factors in the time bounds, n would need to be approximately 10 forthe convolution-based algorithm to be faster than the sieving algorithm. Because it is simpleto code and fast for smaller values of n , the results in Figure 2 were calculated using thesieving algorithm. The high density of cold positions in subtract-a-square is surprising, especially in view ofearlier conjectures in the theory of square-difference-free sets that the number of values up to n in such a set could be at most n / o (1) [15]. These conjectures were disproven by findingsets of numbers of a special form: numbers whose radix- b representation, for a carefullychosen base b , use only base- b digits from a square-difference-free set (modulo b ) in their evendigit positions [1, 10, 13]. Although the cold positions of subtract-a-square have somewhatlower density than these constructions, they arise more naturally, and it is of interest toinvestigate their modular structure and compare it to the structure of these other knowndense square-difference-free sets.The idea of considering the base- b structure of these positions, for different choices ofthe base b , also arises from the consideration of a different subtraction game, described byGolomb [7]. This game has as its subtraction set the Moser–de Bruijn sequence0 , , , , , , , , , , , , . . . of numbers that are sums of distinct powers of four. That is, when written in base 4, thenumbers of the subtraction set have only 0 and 1 as their base-4 digits. The nim-valueof any position n may be obtained by writing n in base 4, taking each digit modulo 2(reducing it to 0 or 1), and then reinterpreting the resulting string of 0’s and 1’s as a binarynumber. Because of this simple formula for its nim-values, the Moser–de Bruijn subtractiongame has both a maximum nim-value and a number of cold positions (among the first n positions) proportional to Θ( √ n ). It subtraction set size, also Θ( √ n ), is comparable to that avid Eppstein 20:9 ones fives twentyfives + + + + + Figure 3
The distribution of digit values among the three low-order base-5 digits of cold positions(for n < ) in subtract-a-square. for subtract-a-square. In particular, for this game, convolution is neither asymptoticallyfaster than dynamic programming nor than sieving, although all of these algorithms can beimproved by using the formula instead. What makes subtract-a-square so different from theMoser–de Bruijn subtraction game?To approach these questions, we performed more computational experiments studying thedistribution of digit values for the cold positions in subtract-a-square, for various bases. Thisstudy follows the earlier work of Golomb [7], who observed that the low-order base-5 digitsof the cold positions among the first first 20,000 game positions were highly non-uniformlydistributed, and of Bush [3], who extended this study to the first 40,000,000 game positions.Figure 3 shows an extension of this study to the first 2 game positions, and to the threelow-order base-5 digits of each cold position. As the figure shows, with a few exceptions,the ones digit of the cold positions lies within the square-difference-free set { , } (mod 5).The fives digit shows no significant non-uniformities, but the twentyfives digit is quite non-uniformly distributed, and is possibly heading towards the same square-difference-free set { , } (mod 5). In this way, the cold positions of subtract-a-square appear to be emulatingthe strategy of the known dense square-difference-free sets [1, 10, 13] of having a square-difference-free set of digits in even digit positions and all possible digits in odd positionsmodulo a base b . In this case b = 5, and following this strategy perfectly for b = 5 would lead F U N 2 0 1 8 sevens thirteens + + + + + Figure 4
The distribution of digit values among the low-order base-7 and base-13 digits of coldpositions (for n < ) in subtract-a-square. to a set of size n log ≈ n . . The slightly slower growth rate of the cold positions insubtract-a-square can be explained by the slow convergence of its higher-order base-5 digitsto square-difference-free sets of digits.What about other bases? Figure 4 shows the results of the same experiment (for thelow-order digits only) for base 7 and base 13. Because 7 is 3 modulo 4, there are no nontrivialsquare-difference-free sets modulo 7: every two numbers modulo 7 differ by a square (mod 7).Perhaps because of this, the digit values in base 7 show no significant nonuniformities.However, modulo 13, the squares are 0, ± ±
3, and ±
4. Because 13 is 1 modulo 4, each ofthe nonzero squares occurs four times among the squares of values mod 13; for instance, ± { , , } (mod 13). Perhaps subtract-a-square implements themodular strategy for finding dense square-difference-free sets in all prime bases (congruentto 1 mod 4) simultaneously? avid Eppstein 20:11 We have developed new convolution-based methods for evaluating arbitrary subtractiongames (either to determine the set of cold positions or to evaluate the nim-value of eachposition). Our experiments on the subtract-a-square game show that its maximum nim-valueis lower than the theoretical value for games with subtraction sets of the same size, andits number of cold positions is higher than the theoretical value. These results show that,asymptotically, our new algorithms are faster than alternative dynamic programming orsieving approaches for the same problems on this game. However, the breakeven point forthe new algorithms is high enough that our convolution-based approach is not yet practical.It would be of interest to develop improved algorithms that are both asymptotically fasterand more practical than existing approaches.In an attempt to investigate why the cold positions of subtract-a-square produce a densesquare-difference-free set, we investigated the base- b representations of the cold positionsfor several small prime choices of b . Our tests found significant irregularities in the evenpositions of these base- b representations, when b is congruent to 1 mod 4. We leave theproblem of finding a theoretical explanation for these patterns, and for the density of thecold positions in subtract-a-square, as open for future research. References R. Beigel and W. Gasarch. Square-difference-free sets of size Ω( n . ... ). Electronicpreprint arxiv:0804.4892, 2008. E. R. Berlekamp, J. H. Conway, and R. K. Guy. Subtraction games.
Winning Ways foryour Mathematical Plays, Vol. I: Games in General , pp. 83–86. Addison-Wesley, 1982. J. H. Conway. Chapter 11: Impartial Games and the Game of Nim.
On Numbers andGames , pp. 122–135. Academic Press, 1976. M. J. Fischer and M. S. Paterson. String-matching and other products.
Complexity of com-putation (Proc. SIAM-AMS Appl. Math. Sympos., New York, 1973) , pp. 113–125. AmericanMathematical Society, SIAM-AMS Proceedings 7, 1974, MR0400782. H. Furstenberg. Ergodic behavior of diagonal measures and a theorem of Szemerédi onarithmetic progressions.
Journal d’Analyse Mathématique S. W. Golomb. A mathematical investigation of games of “take-away”.
Journal of Combi-natorial Theory P. M. Grundy. Mathematics and games.
Eureka A. Kalai. Efficient pattern-matching with don’t cares.
Proceedings of the 13th Annual ACM-
SIAM Symposium on Discrete Algorithms (SODA ’02) , pp. 655–656. Society for Industrialand Applied Mathematics, 2002, https://dl.acm.org/citation.cfm?id=545381.545468. M. Lewko. An improved lower bound related to the Furstenberg-Sárközy theorem.
Elec-tronic Journal of Combinatorics S. Muthukrishnan and K. Palem. Non-standard stringology: Algorithms and complexity.
Proceedings of the 26th Annual ACM Symposium on Theory of Computing (STOC ’94) ,pp. 770–779. ACM, 1994, doi:10.1145/195058.195457. J. Pintz, W. L. Steiger, and E. Szemerédi. On sets of natural numbers whose difference setcontains no squares.
Journal of the London Mathematical Society (2nd Series)
F U N 2 0 1 8 I. Z. Ruzsa. Difference sets without squares.
Periodica Mathematica Hungarica A. Sárkőzy. On difference sets of sequences of integers. I.
Acta Mathematica Academiae Sci-entiarum Hungaricae A. Sárközy. On difference sets of sequences of integers. II.
Annales Universitatis ScientiarumBudapestinensis de Rolando Eötvös Nominatae A. F. Siegel. Robust regression using repeated medians.
Biometrika R. P. Sprague. Über mathematische Kampfspiele.