IMPROVEMENTS ON CHOMP

Xinyu Sun

Department of Mathematics, Temple University, Philadelphia, PA 19122, USA

                          xysun@math.temple.edu

Received: 10/16/01, Revised: 4/29/02, Accepted: 5/17/02, Published: 5/20/02

Abstract

The article extends the maple program in [TC] by calculating P-positions with arbitrary number of rows versus three rows. It also presents a formula similar to the one in [WW] by allowing the second column to have three pieces.

1. Introduction

Chomp [CH] is a two-player game that starts out with an M by N chocolate bar, in which the square on the top-left corner is poisonous. A player must name a remaining square, and eat it together with all the squares below and/or to the right of it. Whoever eats the poisonous one (top-left) loses. The game can also be interpreted as two players alternately naming a divisor of a given number N, which may not be multiples of previously named numbers. Whoever names 1 loses.

An example, given in [WW], shows if N = 16 × 27, we have a chocolate bar like the following:

1 2 4 8 16
3 6 12 24 48
9 18 36 72 144
27 54 108 216 432

Thus, naming number 24 is to eat all the squares that are multiples of 24, i.e. the squares below and/or to the right of it.

With infinite two-dimensional Chomp, the result is obvious, the first player eats the square at 2 × 2, then mimics his opponent’s move by eating the same number of squares on the X-axis as his opponent eats on the Y -axis, and vice versa. David Gale offers a prize of $100.00 for the first complete analysis of 3D-Chomp, i.e. where N has three distinct prime divisors, raised to arbitrary high powers [GC]. As easy and lucrative as it seems, nobody has a complete analysis of FINITE 2D-Chomp yet!

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

2. What Do We Know

Some trivial results can be easily seen. For example, any rectangular position is an N - position; any P-position with two rows must look like (α, α − 1) (α > 1), i.e. positions with α squares in the first row, and α − 1 squares the second. An N -position does not necessarily have a unique winning move either. For example, (3, 2, 1) has three winning moves, (3, 1, 1), (2, 2, 1), and (3, 2). Ken Thompson found that 4 × 5 and 5 × 2 both are the winning moves for 8 × 10 [WW].

Some of the P-positions are given in [WW]. The author calculated some threerowed and four-rowed P-positions with the help of computers. Doron Zeilberger gives a computer program that finds patterns for three-rowed Chomp with the third row fixed in [TC]. The most complete result for special cases of Chomp with more than three rows was given in [WW]: for a Chomp position with x rows, and a squares in the first row, b squares in the second, and one square for the rest of the rows, to be a P-position it must have the following form:

x = \{ \begin{matrix}⌊\frac{2a+b}{2}⌋ & if a + b even \\ min\{⌈\frac{2a−b}{2}⌉, ⌈\frac{3(a−b)}{2}⌉\} & if a + b odd \end{matrix}

3. Results

In this section we adopt the notation used in both [WW] and [TC], namely we use [a, b, c] to represent a three-rowed Chomp position with a + b + c squares in the first row, a + b in the second, a in the third. So, we are writing Chomp positions “upside down”.

As we know, the formula for two-rowed P-positions are trivial, i.e. [a, 1] (a > 0). And, it looks simple for three-rowed, with the third row fixed, since it always appears to be [a, b+x, c], where a, b, c are fixed integers and x is a symbolic variable for all non-negative integers. The simplest example might be [2, x, 2], which characterizes [2, 0, 2], [2, 1, 2], [2, 2, 2], [2, 3, 2] ... as P-positions.

The author created a Maple program to calculate Chomp P-positions of arbitrary number of rows and columns (to the limit of computers, of course). To our pleasure, things do get more complicated with more rows. Instead of having symbolic variables whose coefficients are 1 as in three-rowed Chomp, we can have coefficients larger than 1. For example, if the value of the bottom two rows of a four-rowed Chomp position is [2, 2], it is a P-position only when it is one of the following: [2, 2, 1, 3], [2, 2, 2, 3], [2, 2, 3 + 2x, 4], [2, 2, 4 + 2x, 2]. So in this case, instead of having one pattern for positions with a large number of squares, we have patterns that compliment each other, and yield the final formula.

To minimize the computational complexity, we fix the bottom k − 2 rows of positions with k rows, and try to find the appropriate formula. As shown in [TC], we use formal power series to calculate P-positions. Every Chomp position can be represented as a monomial in the formal power series 1/(1 − x_{1})...(1 − x_{k}). For example, [2, 0, 2] will be x_{1}^{2}x_{2}^{2}x_{3}^{4} (remember we are reading the Chomp positions upside down). Now we can define weight on Chomp positions. For a position [x_{1}, ..., x_{k}], we define x_{k} has weight 1, x_{k−1} has weight 2, and so on. It is easily seen that the weight is the exact number of squares the position has. Since we are fixing all the rows except two, we are going to have a formal power series generating function that requires only two variables. So we have a generating function,

\frac{1}{(1 − x_{1})(1 − x_{2})} − 1 − ∑_{{[y_{1},y_{2},...,y_{k−2},w_{1},w_{2}]∈P \atop [y_{1},y_{2},...,y_{k−2},w_{1},w_{2}]∈N}} x_{1}^{w_{1}}x_{2}^{w_{2}}

where [y_{1}, y_{2}, …, y_{k−2}] are the fixed bottom rows, P is the set of all known P-positions, N is the set of all N -positions derived from P. Once we find a new P-position, we update the generating function by inserting the new position into P and updating N correspondingly. The next P-position will be the monomial with a positive coefficient and the least weight. Of course, during the calculation, positions might be deducted from the formal series multiple times, e.g. [1, 1, 1] ((3, 2, 1) if we use the original notation), but all this does is to change the coefficient from 1 to a negative number instead of 0, which does not have any effect on our result.

Since we do not know the coefficient β of the patterns α + βx with x as the symbolic variable for all the non-negative integers, we have to make educated guesses for the values in the Maple program. Whenever the program finds a pre-defined number of positions with the same number of rows, the values of the second rows form an arithmetic series whilst the other rows are identical, it tries to validate the formula. For example, positions like [2, 2, 3, 4], [2, 2, 5, 4], [2, 2, 7, 4] and [2, 2, 9, 4] suggest the formula [2, 2, 3 + 2x, 4]. The newly generated formula will be checked against the existing P-positions by verifying that the formula will not create any known N -positions. Of course the formulas can still be erroneous and the program is capable of correcting itself by eliminating the formula when that happens. The formulas are validated when no more P-positions can be generated. The life cycle of a conjecture is completed once a formula is validated or corrected.

The computer program was written in Maple, and can be downloaded at http://www.math.temple.edu/˜ xysun along with some pre-calculated results. Type in Help() for help. People can also play Chomp against a computer. Type in Play-Chomp(POS) where POS is the initial position. The user and computer will take turns to name the piece they want to erase from the position. The program uses precalculated results. If the computer cannot find a winning move, or if the position is beyond the range of the results, the program will randomly eliminate a piece from the position so the game will go on.

With the help of the program, we have the following:

Theorem 1: For a Chomp position with x rows, a squares in the first row, b squares in the second, two squares in the third, and one square for the rest of the rows, to be a P-position, it must satisfy the following formula:

x = \{ \begin{matrix}1 & if a = 1 \\ 2 & if a = b + 1 \\ ⌊\frac{2a+b}{2}⌋ & if a + b odd and a ≠ b + 1 \\ ⌊\frac{3a}{2}⌋ + 1 & if a = b \\ min\{⌈\frac{2a−b}{2}⌉, \frac{3(a−b)}{2}\} & if a + b even and a ≠ b \end{matrix}

Definition: We call the height h of a Chomp position [a_{1}, …, a_{n}] to be the number x

such that either \underbrace{[1, 0, …, 0, a_{1} − 1, …, a_{n}]}_{x} (x > n), or [∑_{k=1}^{n−x+1} a_{k}, a_{n−x+2}, …, a_{n}] (x ≤ n)

is a P-position, and we write h([a_{1}, …, a_{n}]) = x.

We are trying to either chomp the position to have only x rows left, or add x − n onesquared rows to the position so that the result is a P-position, e.g. h([1, 0, …, 0]) = 1, h([\underbrace{2, 0, …, 0}_{n}]) = n + 1, and h([a_{1}, …, a_{n−1}, a_{n−1} + 1]) = 2. The following lemma assures

us the existence and the uniqueness of the height for any Chomp position. Let us first denote F ([a_{1}, …, a_{n}]) to be the set of followers of [a_{1}, …, a_{n}], i.e. all the positions that can be derived from the position by one chomp, and mex({b_{1}, …, b_{m}}), the M inimal EXclusion, to be the least nonnegative integer that is not in the set {b_{1}, …, b_{m}}.

Lemma 1: For any Chomp position [a_{1}, …, a_{n}], h([a_{1}, …, a_{n}]) uniquely exists, and h([a_{1}, …, a_{n}]) = x, if there exists an x ≤ n such that [∑_{k=1}^{n−x+1} a_{k}, a_{n−x+2}, …, a_{n}] is a Pposition; otherwise h([a_{1}, …, a_{n}]) = mex{h([a′_{1}, …, a′_{n}]) | [a′_{1}, …, a′_{n}] ∈ F ([a_{1}, …, a_{n}])}.

Proof: The case for x ≤ n is trivial by the definition of h. If such an x does not exist, and y = mex{h([a′_{1}, …, a′_{n}]) | [a′_{1}, …, a′_{n}] ∈ F ([a_{1}, …, a_{n}])}, then y > n and the followers of \underbrace{[1, 0, …, 0, a_{1} − 1, …, a_{n}]}_{y}) are all N -positions by the definition of mex, therefore the

position itself is a P-position. For the uniqueness part, we only have to notice that for any two positive integers x_{1} < x_{2}, the position generated by the methods above using x_{1} is the follower of the one generated using x_{2}, thus at most one of them is a P-position.

Now we can rewrite the theorem as Theorem 1′:

h([2, b − 2, a − b]) = \{ \begin{matrix}1 & if a = 1 \\ 2 & if a = b + 1 \\ ⌊\frac{2a+b}{2}⌋ & if a + b odd and a ≠ b + 1 \\ ⌊\frac{3a}{2}⌋ + 1 & if a = b \\ min\{⌈\frac{2a−b}{2}⌉, \frac{3(a−b)}{2}\} & if a + b even and a ≠ b \end{matrix}

Proof of Theorem 1: Notice that the result is strikingly similar to the one given in [WW] except when a = b and a = b + 1, and the two results compliment each other perfectly.

We denote the number of squares of the first, second, and third rows as α, β and γ respectively, and those of the first and second columns x and y. In our case, we only consider the positions with y = 3 and γ = 2:

X X X X X X X X X X X X X  α
X X X X X  β
X X  γ

X X X

x y

The first two scenarios for x = 1, 2 are trivial and we will avoid those cases in the discussion below. By Lemma 1, we have to consider the height of all the followers of [2, b − 2, a − b].

From the position, we can chomp to

the first row up to b + 1 (b < α < a, β = b, and γ = 2)  (1)
the first and the second row (α = β, 2 ≤ β ≤ b, and γ = 2)  (2)
the second row only (α = a, 2 ≤ β < b, and γ = 2)  (3)
the second and third row (α = a, β = 1 and γ = 1)  (4)
the third row only (α = a, β = b and γ = 1)  (5)

By proper induction on a and b, we can deduct the following equations:

x = min \{\frac{3(α−b)}{2}, ⌈\frac{2α−b}{2}⌉\} if b < α < a, α + b even  (6)
x =  ⌊\frac{2α+b}{2}⌋  if b < α < a, α + b odd  (7)
x =  ⌊\frac{3β}{2} ⌋ + 1  if 1 < β ≤ b  (8)
x = min \{\frac{3(a−β)}{2}, ⌈\frac{2a−β}{2} ⌉\} if 2 ≤ β < b, a + β even  (9)

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 2 (2002), #G01 6

x =  ⌊\frac{2a+β}{2} ⌋  if 2 ≤ β < b, a + β odd  (10)
x =  a  (11)
x =  ⌊\frac{2a+b}{2}⌋  if a + b even  (12)
x = min \{⌈\frac{2a−b}{2}⌉ , ⌈\frac{3(a−b)}{2}⌉\} if a + b odd  (13)

where equation 1 yields equations 6 and 7, 2 yields 8, 3 yields 9 and 10, 4 yields 11, 5 yields 12 and 13

It is easy to see that 3(α − β) ≤ (2α − β) iff α ≤ 2β So from equation 6 we can have:

either x = \frac{3(α − b)}{2} when α ≤ 2b and α + b even

which yields: (α is always incremented by 2 in the following arguments)

x = 3, …, \frac{3b}{2} incremented by 3 if b even and a ≥ 2b (14)
and α = b + 2, …, 2b
x = 3, …, \frac{3(b−1)}{2} incremented by 3 if b odd and a ≥ 2b  (15)
and α = b + 2, …, 2b − 1
x = 3, …, \frac{3(a−b−2)}{2} incremented by 3 if a + b even and a ≤ 2b  (16)
and α = b + 2, …, a − 2
x = 3, …, \frac{3(a−b−1)}{2} incremented by 3 if a + b odd and a ≤ 2b  (17)
and α = b + 3, …, a − 1

or x = ⌈\frac{2α − b}{2}⌉ when α ≥ 2b and α + b even

which yields:

x = \frac{3b}{2}, …, \frac{2a−b−4}{2} incremented by 2 if a even, b even  (18)
and α = 2b, …, a − 2
x = \frac{3b+3}{2}, …, \frac{2a−b−3}{2} incremented by 2 if a odd, b odd  (19)
and α = 2b + 1, …, a − 2
x = \frac{3b+3}{2}, …, \frac{2a−b−1}{2} incremented by 2 if a even, b odd  (20)
and α = 2b + 1, …, a − 1
x = \frac{3b}{2}, …, \frac{2a−b−2}{2} incremented by 2 if a odd, b even  (21)
and α = 2b, …, a − 1

From equation 7:

x = \frac{3b+6}{2}, …, \frac{2a+b−2}{2} incremented by 2 if a even and b even  (22)

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 2 (2002), #G01 7

and α = b + 3, …, a − 1
x = \frac{3b+5}{2}, …, \frac{2a+b−3}{2} incremented by 2 if a odd and b odd  (23)
and α = b + 3, …, a − 1
x = \frac{3b+5}{2}, …, \frac{2a+b−5}{2} incremented by 2 if a even and b odd  (24)
and α = b + 3, …, a − 2
x = \frac{3b+6}{2}, …, \frac{2a+b−4}{2} incremented by 2 if a odd and b even  (25)
and α = b + 3, …, a − 2

Note that we are avoiding the case α = β + 1.

From equation 8 we have

x = 4, 5, 7, 8, …, ⌊\frac{3b}{2}⌋ + 1  (26)

which are all the numbers from 4 to ⌊\frac{3b}{2}⌋ + 1 that are NOT divisible by 3.

From equation 9 the result is similar to that from equation 6. From equation 10

x = a + 1, …, a + \frac{b−2}{2} if a even and b even  (27)
x = a + 1, …, a + \frac{b−1}{2} if a odd and b odd  (28)
x = a + 1, …, a + \frac{b−2}{2} if a odd and b even  (29)
x = a + 1, …, a + \frac{b−3}{2} if a even and b odd  (30)

Equations 11, 12 and 13 result in constant numbers that require no further discussion. Now we can deduct our result from the equations. Assuming a ≥ 2b, we have: x always covers 3, …, ⌊\frac{3b+2}{2}⌋ from equations 14, 15 and 26. x covers \frac{3b+4}{2}, …, \frac{2a−b−2}{2} but not \frac{2a−b}{2} = ⌈\frac{2a−b}{2}⌉ if a even and b even from equations

18 and 22. Note that the values from the two equations are mutually exclusive, and had x covered \frac{2a−b}{2}, it would have appeared in equation 18, which does not.

x covers \frac{3b+3}{2}, …, \frac{2a−b−1}{2} but not \frac{2a−b+1}{2} = ⌈\frac{2a−b}{2}⌉ if a odd and b odd from equations 19 and 23, by similar reasoning as shown above.

All the other equations are either dealing with a + b odd, or have result bigger that ⌈\frac{2a−b}{2}⌉. So the height of the position, which is the least number NOT in the above numbers, is ⌈\frac{2a−b}{2}⌉ when a + b even.

If a even and b odd, x covers \frac{3b+3}{2}, …, \frac{2a−b+1}{2} from equations 20 and 24; \frac{2a−b+1}{2}, …, a− 1 from 9 since a ≥ 2b; a from 11; a + 1, …, a + \frac{b−3}{2} from 30. And the other equations are insignificant as discussed above. So the height of the position is a + \frac{b−1}{2} = ⌊\frac{2a+b}{2}⌋.

If a odd and b even, x covers \frac{3b+4}{2}, …, \frac{2a−b}{2} from equations 21 and 25; \frac{2a−b}{2}, …, a − 1 from 9 since a ≥ 2b; a from 11; a + 1, …, a + \frac{b−2}{2} from 29. And the other equations are insignificant as discussed above. So the height of the position is a + \frac{b}{2} = ⌊\frac{2a+b}{2}⌋.

Hence we have proved when a ≥ 2b,

x = \{ \begin{matrix}⌊\frac{2a+b}{2}⌋ & if a + b odd \\ ⌈\frac{2a−b}{2}⌉ & if a + b even \end{matrix}

The rest of the proof, i.e. when a = b and b < a < 2b, is similar to the above, and is left to the interested readers.

4. Future Work

It will be interesting to find out the formulas for the P-positions with the second columns having more than three squares or the formulas for other 3-rowed positions. Also, since we are looking for the P-positions, it will be worthwhile to find out the formula for the Sprague-Grundy function.

Finally, can we eventually claim the $100.00 prize from David Gale?

5. Acknowledgement

Many thanks to my advisor Dr. Doron Zeilberger. Without his help, this article would not be here. Also many thanks to the referee for his suggestions which made this article much clearer.

References

[CH] D. Gale, A Curious Nim-type game, Amer. Math. Monthly 81 (1974), 876-879

[GC] Richard J. Nowakowski, Games of No Chance, Cambridge University Press, 1998, 482

[TC] Doron Zeilberger, Three-Rowed CHOMP, Adv. Appl. Math. v. 26 (2001), 168-179

[WW] E. R. Berlekamp, J.H. Conway, and R. K. Guy, Winning Ways for Your Mathematical Plays, Academic Press, London, 1982. 598-599