OFFSET
0,4
COMMENTS
Observe that many "safe" three-pile positions in Nim (1-2-3, 1-4-5, 2-4-6, etc.) consist of one pile whose size is the sum of the sizes of the other two. The "Break" move is designed to trivially defeat these positions by breaking the large pile into copies of the other two. This leaves a clear winning position where every pile has a "twin".
Like the standard Nimsum function defined in A003987, this relation constitutes an Abelian group over nonnegative integers where every element is its own inverse.
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..11324 (first 150 antidiagonals, flattened).
FORMULA
NSum(x,y) = Flip(Flip(x) XOR Flip(y))
Where XOR is the bitwise exclusive OR characteristic of A003987.
Flip(n) = 0 if n == 0.
= n+1 if n is odd.
= n-1 if n is even.
EXAMPLE
The square table defining the relation begins:
0 1 2 3 4 5 6 7 8 9 ...
1 0 4 5 2 3 8 9 6 7 ...
2 4 0 6 1 8 3 10 5 12 ...
3 5 6 0 8 1 2 11 4 13 ...
4 2 1 8 0 6 5 12 3 10 ...
5 3 8 1 6 0 4 13 2 11 ...
6 8 3 2 5 4 0 14 1 16 ...
7 9 10 11 12 13 14 0 16 1 ...
8 6 5 4 3 2 1 16 0 14 ...
9 7 12 13 10 11 16 1 14 0 ...
. . . . . . . . . .
Reading from the table, 1-2-4, 1-3-5 and 2-3-6 are safe positions in Take-or-Break Nim.
MATHEMATICA
A257092[n_, k_] := #[BitXor[#[n], #[k]]] & [If[# == 0, 0, # - (-1)^#] &];
Table[A257092[n-k, k], {n, 0, 12}, {k, 0, n}] (* Paolo Xausa, Apr 20 2026 *)
PROG
(PARI) flip(x) = if (x==0, 0, if (x % 2, x+1, x-1));
tabl(nn) = {for (n=0, nn, for (k=0, nn, print1(flip(bitxor(flip(n), flip(k))), ", "); ); print(); ); } \\ Michel Marcus, Apr 23 2015
CROSSREFS
AUTHOR
Patrick McKinley, Apr 19 2015
STATUS
approved
