

A003987


Table of n XOR m (or Nimsum of n and m) read by antidiagonals, i.e., with entries in the order (n,m) = (0,0), (0,1), (1,0), (0,2), (1,1), (2,0), ...


150



0, 1, 1, 2, 0, 2, 3, 3, 3, 3, 4, 2, 0, 2, 4, 5, 5, 1, 1, 5, 5, 6, 4, 6, 0, 6, 4, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 6, 4, 6, 0, 6, 4, 6, 8, 9, 9, 5, 5, 1, 1, 5, 5, 9, 9, 10, 8, 10, 4, 2, 0, 2, 4, 10, 8, 10, 11, 11, 11, 11, 3, 3, 3, 3, 11, 11, 11, 11, 12, 10, 8, 10, 12, 2, 0, 2, 12, 10, 8, 10, 12, 13, 13, 9, 9
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,4


COMMENTS

Another way to construct the array: construct an infinite square matrix starting in the top left corner using the rule that each entry is the smallest nonnegative number that is not in the row to your left or in the column above you.
After a few moves the matrix looks like this:
0 1 2 3 4 ...
1 0 3 2 5 ...
2 3 0 1 ?
The ? is then replaced with a 6.


REFERENCES

E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 5153.
Eric Friedman, Scott M. Garrabrant, Ilona K. PhippsMorgan, A. S. Landsberg and Urban Larsson, Geometric analysis of a generalized Wythoff game, in Games of no Chance 5, MSRI publ. Cambridge University Press, date?
D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998; see p. 190. [From N. J. A. Sloane, Jul 14 2009]
R. K. Guy, Impartial games, pp. 3555 of Combinatorial Games, ed. R. K. Guy, Proc. Sympos. Appl. Math., 43, Amer. Math. Soc., 1991.


LINKS

T. D. Noe, Rows n=0..100 of triangle, flattened
J.P. Allouche and J. Shallit, The Ring of kregular Sequences, II, Theoret. Computer Sci., 307 (2003), 329.
Rémy Sigrist, Colored representation of T(x,y) for x = 0..1023 and y = 0..1023 (where the hue is function of T(x,y) and black pixels correspond to zeros)
N. J. A. Sloane, My favorite integer sequences, in Sequences and their Applications (Proceedings of SETA '98).
Index entries for sequences related to Nimsums


FORMULA

T(2i,2j) = 2T(i,j), T(2i+1,2j) = 2T(i,j) + 1.


EXAMPLE

Table begins
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
[1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10]
[2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8]
[3, 2, 1, 0, 7, 6, 5, 4, 11, 10]
[4, 5, 6, 7, 0, 1, 2, 3, 12]
[5, 4, 7, 6, 1, 0, 3, 2]
[6, 7, 4, 5, 2, 3, 0]
[7, 6, 5, 4, 3, 2]
[8, 9, 10, 11, 12]
[9, 8, 11, 10]
[10, 11, 8]
[11, 10]
[12]
...................
The first few antidiagonals are:
[0]
[1, 1]
[2, 0, 2]
[3, 3, 3, 3]
[4, 2, 0, 2, 4]
[5, 5, 1, 1, 5, 5]
[6, 4, 6, 0, 6, 4, 6]
[7, 7, 7, 7, 7, 7, 7, 7]
[8, 6, 4, 6, 0, 6, 4, 6, 8]
[9, 9, 5, 5, 1, 1, 5, 5, 9, 9]
[10, 8, 10, 4, 2, 0, 2, 4, 10, 8, 10]
[11, 11, 11, 11, 3, 3, 3, 3, 11, 11, 11, 11]
[12, 10, 8, 10, 12, 2, 0, 2, 12, 10, 8, 10, 12]
...


MAPLE

nimsum := proc(a, b) local t1, t2, t3, t4, l; t1 := convert(a+2^20, base, 2); t2 := convert(b+2^20, base, 2); t3 := evalm(t1+t2); map(x>x mod 2, t3); t4 := convert(evalm(%), list); l := convert(t4, base, 2, 10); sum(l[k]*10^(k1), k=1..nops(l)); end; # memo: adjust 2^20 to be much bigger than a and b
AT := array(0..N, 0..N); for a from 0 to N do for b from a to N do AT[a, b] := nimsum(a, b); AT[b, a] := AT[a, b]; od: od:
# alternative:
read("transforms") :
A003987 := proc(n, m)
XORnos(n, m) ;
end proc: # R. J. Mathar, Apr 17 2013
seq(seq(Bits:Xor(k, mk), k=0..m), m=0..20); # Robert Israel, Dec 31 2015


MATHEMATICA

Flatten[Table[BitXor[b, a  b], {a, 0, 10}, {b, 0, a}]] (* BitXor and Nim Sum are equivalent *)


PROG

(PARI) tabl(nn) = {for(n=0, nn, for(k=0, n, print1(bitxor(k, n  k), ", "); ); print(); ); };
tabl(13) \\ Indranil Ghosh, Mar 31 2017
(Python)
for n in xrange(0, 14):
....print [k^(n  k) for k in xrange(0, n + 1)] # Indranil Ghosh, Mar 31 2017


CROSSREFS

Initial rows are A001477, A004442, A004443, A004444, etc. Cf. A051775, A051776.
Cf. A003986 (OR) and A004198 (AND).
Antidiagonal sums are in A006582.
Sequence in context: A323212 A185815 A321132 * A307302 A307297 A307301
Adjacent sequences: A003984 A003985 A003986 * A003988 A003989 A003990


KEYWORD

tabl,nonn,nice,look


AUTHOR

Marc LeBrun


STATUS

approved



