Single-delete Nim
Abstract
The classic game of Nim has been well-known for many years, inspiring numerous variations. One such variant is Delete Nim, where players take turns eliminating one pile of stones and splitting the remaining pile into two smaller piles. In this paper we generalize the game to include the case of piles. On each turn, a player eliminates one pile and splits one of the remaining piles into two smaller piles. We specifically analyze the case where , deriving the conditions for a winning strategy.
1 Introduction and Main Result
1.1 Introduction
Nim is a well-known game that has been studied extensively over the years. In the most popular version of Nim, there are three piles of stones, and two players take turns. On their turn, a player selects one pile and removes any positive number of stones from that pile. The players continue taking turns, and the player who removes the last stone wins the game. This game can also be played with more than three piles following the same rules.
Nim is a two-player, zero-sum, finite, deterministic, and perfect information game with no possibility of a draw. Therefore, every configuration can be classified as either an N-position, where the player whose turn it is can force a win, or a P-position, where the player whose turn it is will inevitably lose if the opponent plays optimally. The classification of N-positions and P-positions in the aforementioned version of Nim was demonstrated by Bouton [3] in 1902. It became known that the conditions for the winning strategy in this game include mathematically intriguing structures.
Several variants of Nim have been proposed by modifying the rules of legal moves, such as Moore’s game [4] and Wythoff’s game [7]. The winning strategies of these variants have been studied extensively, and their mathematical formulations have attracted significant interest. In this study, we generalize Delete Nim, a game introduced by Abuku and Suetsugu [2], where players eliminate one pile and then split one of the remaining piles into two smaller piles in one move. We then investigate the winning strategy for this generalized version.
1.2 Delete Nim
In this section, we first describe the rules of Delete Nim, which form the basis of this study. There are two variations of the Delete Nim rules provided in [2] and [6]. Although the rules differ in presentation, they are equivalent with respect to legal moves. In this paper, we adopt the latter rules111In [2], the rule described here is referred to as the “Variant of Delete Nim” (VDN)..
In Delete Nim, there are two piles of stones. On each turn, players perform the following two actions sequentially (we refer to these combined actions as a move), then pass the turn to their opponent.
-
•
Select one of the piles and remove all the stones from it, eliminating the pile.
-
•
Split the remaining pile into two new piles, ensuring that each new pile contains at least one stone.
A player unable to make this move on their turn loses the game. We denote a position in Delete Nim by , where and represent the number of stones in the two piles. Let be the set of positive integers. Then, the set of all possible game positions (without specifying the current player’s turn) is denoted by . At the position , the player whose turn it loses the game.
Similar to Nim, Delete Nim is a two-player, zero-sum, perfect information, deterministic, finite game with no possibility of a draw. Therefore, each position in can be classified as either an N-position or a P-position. The condition for determining this classification is as follows.
Theorem 1.1 ([2, 6]).
In Delete Nim, a position is a P-position if both and are odd; otherwise, it is an N-position.
This theorem is included in Proposition 4.1 in this paper. It should be noted that in [2], not only is the above classification provided, but the Sprague-Grundy number of each position is also determined. In an N-position, a player can ensure winning by forcing their opponent into P-positions with optimal moves. For example, when the current position is , the player on turn can proceed as (and then the game proceeds as and ends) and secure winning. Therefore, identifying the P-positions is equivalent to understanding a winning strategy and knowing the conditions for winning.
1.3 Single-delete Nim
In this section, we define an extended rule that generalizes Delete Nim to any number of piles. Let be an integer greater than or equal to 2.
Definition 1.2 (Single-delete Nim).
There are piles of stones. On each turn, the two players perform the following two actions sequentially, then pass the turn to their opponent.
-
•
Select one of the piles and remove all the stones from it, eliminating the pile.
-
•
Select one of the remaining piles and split it into two new piles, ensuring that each new pile contains at least one stone.
A player unable to make this move on their turn loses the game.
In Single-delete Nim, it is important to note that the number of piles remains at the end of each turn.
Remark 1.3.
We introduce the term “Single-delete Nim” in this paper. When generalizing the number of piles in Delete Nim, various extended rules can be considered depending on how piles are eliminated and split. The name “Single-delete Nim” explicitly refers to the rule of eliminating only one pile. For more details, see Abuku et al. [1].
The following result for Single-delete Nim with three piles is known from Sakai [5]. To present the winning and losing conditions, we define the following notation: For , if is divisible by but not divisible by , we denote it as . When is odd, we define .
Theorem 1.4.
A necessary and sufficient condition for the position in Single-delete Nim with three piles to be a P-position is
() .
A proof of Theorem 1.4 is provided in [5] (pp.59-63). However, as it is also relevant for the case of four piles, we restate it in Section 2.1 of this paper.
1.4 Main Result
As the main theorem of this paper, we present the necessary and sufficient condition to be a P-position in Single-delete Nim with four piles as Theorem 1.5. To state this theorem, we introduce notation related to the binary representation of positive integers. Let represent the -th digit from the right in the binary representation of . In other words, if the quotient of divided by is even, then ; if the quotient is odd, then . We note that .
Theorem 1.5.
In Single-delete Nim with four piles, for a position , let . When , the necessary and sufficient condition for to be a P-position is that one of the following conditions (1) to (5) is satisfied.
-
(1).
.
-
(2).
and
(2A) . -
(3).
and all of (3A)-(3C) are satisfied.
(3A) ,
(3B) for ,
(3C) . -
(4).
and all of (4A)-(4E) are satisfied.
(4A) ,
(4B) for ,
(4C) ,
(4D) for ,
(4E) . -
(5).
and all of (5A)-(5F) are satisfied.
(5A) for ,
(5B) ,
(5C) for ,
(5D) ,
(5E) for ,
(5F) .
The organization of this paper is as follows. In Section 2, we present a proof of Theorem 1.4, which provides the classification of N-positions and P-positions for Single-delete Nim with three piles, along with several useful propositions. In Section 3, we give a proof of Theorem 1.5, which addresses the case with four piles. In Section 4, we offer a brief analysis of the scenario when the number of piles is five or more.
2 Single-delete Nim with three piles
In this section, we address a proof of Theorem 1.4 for the case with three piles. To support this proof, we prepare the following propositions. These are nearly self-evident facts, so the proofs are omitted here, but we present them collectively as they will be frequently used in the next chapter as well.
Proposition 2.1.
For satisfying , the following facts (i) and (ii) hold.
-
(i).
If , then ,
-
(ii).
If , then .
Proposition 2.2.
When and , for any non-negative integer , there exist such that and .
Proof of Theorem 1.4. Let denote the set of all positions that satisfy condition (). This set is a subset of , which represents all positions in Single-delete Nim with three piles. Let denote the set of all other positions. In the progression of this game, the total number of stones across all piles decreases monotonically. Since includes the terminal position , it is sufficient to show that no position in can be moved to any another position in , and that any position in can be moved to some position in .
First, assume . In this case, since , it is sufficient to consider the next move where the pile with stones is eliminated and the pile with stones is split into two piles with and stones, resulting in the position . By Proposition 2.1(i), if then . This implies that cannot satisfy (). Therefore, any position in cannot be moved to another position in .
Next, assume . Since is not satisfied, it is sufficient to consider the case where . By Proposition 2.2, the pile with stones can be split into two piles with and stones such that . Then, by eliminating the pile with stones and splitting, the position can be moved to . Thus, any position in can be moved to a position in .
3 Single-delete Nim with four piles
3.1 Necessity of given conditions
In this section, we present a detailed proof of Theorem 1.5, which establishes the necessary and sufficient conditions for a position in Single-delete Nim with four piles to qualify as a P-position. We first briefly explain the necessity of some conditions (1) to (5) in Theorem 1.5 through a comparison of specific examples. The necessity of all the conditions will be discussed in detail in the proof of Lemma 3.2 later.
-
(1).
A specific example of a position in this case is
. In its binary representation, it iswhere the rightmost 1’s are in the same digits.
-
(2).
A specific example of a position in this case is
. In its binary representation, it isIn a similar position
where condition (2A) is not satisfied, by eliminating and partitioning into and , it is possible to fulfill condition (2) in a move, resulting in
-
(3).
A specific example of a position in this case is
. In its binary representation, it isIn a similar position
where condition (3B) is not satisfied, by eliminating and partitioning into and , it is possible to fulfill condition (3) in a move, resulting in
-
(4).
A specific example of a position in this case is
. In its binary representation, it isIn a similar position
where condition (4B) is not satisfied, by eliminating and partitioning into and , it is possible to fulfill condition (3) in a move, resulting in
-
(5).
A specific example of a position in this case is
. In its binary representation, it isIn a similar position
where condition (5A) is not satisfied, by eliminating and partitioning into and , it is possible to fulfill condition (4) in a move, resulting in
3.2 Proof of Theorem 1.5
In this section, we will prove Theorem 1.5. Let
be the set of all positions in Single-delete Nim with four piles. We say that is a standard form if it satisfies . Rearranging the elements of in this order is referred to as the standardization of .
We define the subset such that a position belongs to if and only if its standardization satisfies any of the conditions (1) to (5) in Theorem 1.5. Let denote the set of all other positions in . In other words, and correspond to the sets of P-positions and N-positions for this game, respectively.
In the progression of this game, the total sum of stones across all piles decreases monotonically, and since includes the terminal position , the proof of Theorem 1.5 requires demonstrating the following two lemmas.
Lemma 3.1.
If , then it cannot be moved to any position in .
Lemma 3.2.
If , then it can be moved to some position in .
To prove these lemmas, we first define common notation. If the standard form of satisfies condition () of Theorem 1.5 (), we denote and define the sets accordingly. Thus, , and by conditions (1) to (5) we have for any .
We now present the following proposition to support our proof of the two lemmas.
Proposition 3.3.
If satisfy and (), and additionally satisfy for all with , then .
Considering the carry in binary addition, it is clear that the above proposition holds. With this in mind, we will now proceed to prove Lemma 3.1 and Lemma 3.2.
Proof of Lemma 3.1. For a position where , if any of the following conditions hold:
() , , ,
then none of the conditions (1) to (5) can be satisfied, and thus the position is not included in . This fact will be frequently used in the explanation below. In this proof, when transitioning from to as a move, we show that if then . We consider the reverse of the operation:
-
•
First, select two of and combine their sum into a single number.
-
•
Then, add a new element .
We consider each case where for .
-
a).
In case :
Since , it is sufficient to consider only the case where the sum is formed in the reverse operation. In this situation, by Proposition 2.1(i), we have . Therefore, regardless of the element added, corresponds to (), and cannot be included in any . -
b).
In case :
Suppose . Let , and we will use the following facts:
() From (2A), we have .
() ?D-
•
We consider whether , formed by the reverse operation where the sum is taken and is added, is included in . Here, we have .
-
–
If , then by (), it cannot satisfy (3C), (4E) or (5F).
-
–
If or , it corresponds to ().
-
–
If and , then by (), it cannot satisfy (4C) or (5D).
Therefore, we can conclude that .
-
–
-
•
We consider whether , formed by the reverse operation where the sum is taken and is added, is included in . Here, we have .
-
–
If , it corresponds to ().
-
–
If , then by (), it cannot satisfy (2A) or (3A).
Therefore, we can conclude that .
-
–
-
•
-
c).
In case :
Suppose . Let , and we will use the following facts:
() From (3A), we have .
() .
() From (3B) and Proposition 3.3, we have .-
•
We consider whether , formed by the reverse operation where the sum is taken and is added, is included in . Here, we have .
-
–
If , then by (), it cannot satisfy (3B), (4D) or (5E).
-
–
If , then by (), it cannot satisfy (4C) or (5D).
-
–
If , and , then by (), it cannot satisfy (4B) or (5C).
-
–
If or , it corresponds to ().
Therefore, we can conclude that .
-
–
-
•
We consider whether , formed by the reverse operation where the sum is taken and is added, is included in . Here, we have .
-
–
If , then by (), it cannot satisfy (4C) or (5D).
-
–
If , then by (), it cannot satisfy (3A).
-
–
If , and , then by () and (), it cannot satisfy (4A) or (5B).
-
–
If or , it corresponds to ().
Therefore, we can conclude that .
-
–
-
•
For , formed by the reverse operation where the sum is taken and is added, it can similarly be shown that it is not included in , just as in the case where the sum is taken and is added.
-
•
We consider whether , formed by the reverse operation where the sum is taken and is added, is included in . Here, we have .
-
–
If , it corresponds to ().
-
–
If and , then by (), it cannot satisfy (2A) or (3A).
-
–
If , it corresponds to ().
Therefore, we can conclude that .
-
–
-
•
-
d).
In case :
Suppose . Let , and we will use the following facts:
() From (4A), we have .
() From (4C), we have .
() From (4B), we have for .
() From (4B) and by using similar arguments as Proposition 3.3,
we have .-
•
We consider whether , formed by the reverse operation where the sum is taken and is added, is included in . Here, we have .
-
–
If , then by (), it cannot satisfy (4B) or (5C).
-
–
If , then by (), it cannot satisfy (4A) or (5B).
-
–
If , , and , then by () and (), it cannot satisfy (4A) or (5A).
-
–
If , then by (), it cannot satisfy (3A).
-
–
If or , it corresponds to ().
Therefore, we can conclude that .
-
–
-
•
For , formed by the reverse operation with the sum and addition of , and for , similarly with the sum , it can be shown that neither is included in , just as in the case where the sum is taken and is added.
-
•
We consider whether , formed by the reverse operation where the sum is taken and is added, is included in . Here, we have .
-
–
If , then by (), it cannot satisfy (4C) or (5D).
-
–
If , then by (), it cannot satisfy (3A).
-
–
If , and , then by () and (), it cannot satisfy (4A) or (5B).
-
–
If or , it corresponds to ().
Therefore, we can conclude that .
-
–
-
•
For , formed by the reverse operation with the sum and addition of , and for , similarly with the sum , it can be shown that neither is included in , just as in the case where the sum is taken and is added.
-
•
-
e).
In case :
Suppose . Let , and define the smallest such that and
() .
We will use the following facts:
() From (5A), we have for
.
() From (5B), we have and
.
() From (5D), we have .
() From (5C), we have for ,
and from (5E), for .
() From (5A) and by using similar arguments as Proposition 3.3, regarding the sum of any two of , .-
•
We consider whether , formed by the reverse operation where the sum is taken and is added, is included in . Here, we have .
-
–
If , then by (), it cannot satisfy (4B).
-
–
If , then by () it cannot satisfy (4A) , and by () and () it cannot satisfy (5A).
-
–
If , then by (), it cannot satisfy (4A) and (5B).
-
–
If , , and , then by () it cannot satisfy (4A), and by () and () it cannot satisfy (5A).
-
–
If , then by (), it cannot satisfy (3A).
-
–
If or , it corresponds to ().
Therefore we can conclude that .
-
–
-
•
For , formed by the reverse operation with the sum and addition of , and for , similarly with the sum , it can be shown that neither is included in , just as in the case where the sum is taken and is added.
-
•
We consider whether , formed by the reverse operation where the sum is taken and is added, is included in . Here, we have .
-
–
If , then by (), it cannot satisfy (4B).
-
–
If , then by () it cannot satisfy (4A), and by () and () it cannot satisfy (5A).
-
–
If , then by (), it cannot satisfy (3A).
-
–
If , and , then by () it cannot satisfy (4A) and by () and () it cannot satisfy (5A).
-
–
If or , it corresponds to ().
Therefore, we can conclude that .
-
–
-
•
For , formed by the reverse operation with the sum and addition of , and for , similarly with the sum , it can be shown that neither is included in , just as in the case where the sum is taken and is added.
-
•
Thus we completes the proof.
Proof of Lemma 3.2. We explicitly show that for not included in , it can be moved to some position that is included in . Let .
-
a).
In case any of the following holds: , , or, :
First we assume . By Proposition 2.2, there exists a partition such that (For example, we set and ). Therefore, can be moved to . Similarly, in the cases , and , it can be moved to some position in . -
b).
In case and (2A) is not satisfied:
By partitioning into and , it can be moved to . -
c).
In case and at least one of (3A),(3B), or (3C) is not satisfied:
-
•
Suppose that (3A) is not satisfied and . By partitioning into and , it can be moved to . The same applies in the case when .
-
•
Suppose that (3C) is not satisfied and . By partitioning into and , it can be moved to .
-
•
Suppose that (3C) is satisfied but (3B) is not. For the smallest such that and , by partitioning into and , it can be moved to .
-
•
-
d).
In case and (4A) is satisfied, and at least one of (4B), (4C), (4D), and (4E) is not satisfied:
-
•
Suppose that (4E) is not satisfied, that is . By partitioning into and, it can be moved to .
-
•
Suppose that (4E) is satisfied but (4D) is not. For the smallest such that and , by partitioning into and , it can be moved to .
-
•
Suppose that (4C) is not satisfied and . By partitioning into and , it can be moved to . The same applies in the case when .
-
•
Suppose (4C), (4D) and (4E) are satisfied but (4B) is not. Define the smallest such that and at least two of , , are 0. For example, if , then by partitioning into and , it can be moved to . The same applies in other cases.
-
•
-
e).
In case and (4B), (4C), (4D) and (4E) are satisfied, but (4A) is not:
Since , at least one of , or is 1, and at least one of them is 0. For example, if and , then by partitioning into and , it can be moved to . The same applies in other cases.
-
f).
In case and (5B) is satisfied, and at least one of (5C), (5D), (5E) and (5F) is not satisfied:
It can be shown similarly as in case d) above.
-
g).
In case and (5C), (5D), (5E), (5F) are satisfied, but (5B) is not:
It can be shown similarly as in case e) above.
-
h).
In case and (5B), (5C), (5D), (5E), (5F) are satisfied, but (5A) is not:
Define the smallest such that and . Since at least one of , , and is 1, and at least two of them are 0. For example, if and , then by partitioning into and , it can be moved to . The same applies in other cases.
Thus we completes the proof.
4 Single-delete Nim with five or more piles
As discussed earlier, the winning and losing conditions for Single-delete Nim with four piles are significantly more complex than those for three or fewer piles. Additionally, it is not yet possible to even conjecture the conditions for scenarios with more piles. For Single-delete Nim with five or more piles, this paper is limited to presenting the following two almost self-evident propositions. In particular, Proposition 4.2 suggests that, unlike the conditions in Theorem 1.4 and Theorem 1.5(1), even if the number of times each pile’s stone count can be divided by 2 is the same, the position does not necessarily become a P-position when there are more piles, indicating that the winning and losing conditions become even more complex.
Proposition 4.1.
In Single-delete Nim with piles, a position
is a P-position if all are odd.
Proof. Let be the set of positions where all are odd. When the player on their turn makes a move from to , exactly one of becomes even. In the next move, the opposite player eliminates one of the odd piles and splits the even pile into two odd piles, thus returning the position back to . Therefore, at the position , the player on their turn is always forced to take their turn in a position belonging to , eventually reaching the terminal position .
Proposition 4.2.
In Single-delete Nim with piles, if the remainder when is divided by 3 is 2, then is a N-position. For any other value of , is a P-position.
Proof. In Single-delete Nim, starting from the initial position
, the positions that appear during the game can be described as having piles with 2 stones and piles with one stone ?i?j.
Considering that on each turn, the player can only remove a pile with 1 or 2 stones and split one of the piles with 2 stones, the game can be reduced to an equivalent stone-picking game of the following form by focusing on the value of .
-
•
On the first turn, the player takes 2 stones from the total of stones. On subsequent turns, each player may take either 1 or 2 stones.
-
•
The player who takes the last stone wins the game.
Therefore, when the remainder of divided by 3 is 2, the first player can always win by taking 2 stones initially. If the opponent then takes 2 stones, the first player should take 1 stone on the next turn; if the opponent takes 1 stone, the first player should take 2 stones. This strategy guarantees a win. The proof for the case when the remainder of divided by 3 is not 2 is omitted.
Acknowledgements
We would like to express our gratitude to Dr. Koki Suetsugu, Prof. Tomoaki Abuku, and Prof. Ko Sakai for their invaluable comments regarding the study presented in this paper. This work was supported by JSPS KAKENHI Grant Number JP21K12191.
References
- [1] Abuku, T., Sakai, K., Shinoda, M., Suetsugu, K.: Some extensions of delete nim. arXiv preprint arXiv(2301.12964)) (2023), https://arxiv.org/abs/2301.12964
- [2] Abuku, T., Suetsugu, K.: Delete Nim. J. Math. Tokushima Univ. 55, 75–81 (2021)
- [3] Bouton, C.L.: Nim, a game with a complete mathematical theory. Ann. of Math. 3(1-4), 35–39 (1901/02)
- [4] Moore, E.H.: A generalization of the game called nim. Ann. of Math. 11(3), 93–94 (1910)
- [5] Sakai, K.: Dividing Pizza with Mathematics (“Sugaku de Pizza wo Kiriwakeru” in Japanese). Alice’s Adventure in Puzzle-Land 4, Nikkei Science Inc. (2021)
- [6] Stankova, Z., Rike, T. (eds.): A Decade of the Berkeley Math Circle: The American Experience, Volume I, MSRI Mathematical Circles Library, vol. 14. American Mathematical Society (2008)
- [7] Wythoff, W.A.: A modification of the game of Nim. Nieuw Arch. Wiskd. 7(2), 199–202 (1907)