cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A051933 Triangle T(n,m) = Nim-sum (or XOR) of n and m, read by rows, 0<=m<=n.

This page as a plain text file.
%I A051933 #47 Dec 17 2021 01:40:13
%S A051933 0,1,0,2,3,0,3,2,1,0,4,5,6,7,0,5,4,7,6,1,0,6,7,4,5,2,3,0,7,6,5,4,3,2,
%T A051933 1,0,8,9,10,11,12,13,14,15,0,9,8,11,10,13,12,15,14,1,0,10,11,8,9,14,
%U A051933 15,12,13,2,3,0,11,10,9,8,15,14,13,12,3,2,1,0,12,13,14,15,8,9,10,11,4,5,6,7,0
%N A051933 Triangle T(n,m) = Nim-sum (or XOR) of n and m, read by rows, 0<=m<=n.
%D A051933 E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
%D A051933 J. H. Conway, On Numbers and Games, Academic Press, p. 52.
%H A051933 Reinhard Zumkeller, <a href="/A051933/b051933.txt">Rows n = 0..127 of triangle, flattened</a> first 50 rows by R. J. Mathar
%H A051933 <a href="/index/Ni#Nimsums">Index entries for sequences related to Nim-sums</a>
%e A051933 {0},
%e A051933 {1,0},
%e A051933 {2,3,0},
%e A051933 {3,2,1,0}, ...
%p A051933 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^(k-1), k=1..nops(l)); end; # memo: adjust 2^20 to be much bigger than a and b
%p A051933 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:
%p A051933 # Alternative:
%p A051933 A051933 := (n, k) -> Bits:-Xor(n, k):
%p A051933 seq(seq(A051933(n, k), k=0..n), n=0..12); # _Peter Luschny_, Sep 23 2019
%t A051933 Flatten[Table[BitXor[m, n], {m, 0, 12}, {n, 0, m}]] (* _Jean-François Alcover_, Apr 29 2011 *)
%o A051933 (Haskell)
%o A051933 import Data.Bits (xor)
%o A051933 a051933 n k = n `xor` k :: Int
%o A051933 a051933_row n = map (a051933 n) [0..n]
%o A051933 a051933_tabl = map a051933_row [0..]
%o A051933 -- _Reinhard Zumkeller_, Aug 02 2014, Aug 13 2013
%o A051933 (Julia)
%o A051933 using IntegerSequences
%o A051933 A051933Row(n) = [Bits("XOR", n, k) for k in 0:n]
%o A051933 for n in 0:10 println(A051933Row(n)) end  # _Peter Luschny_, Sep 25 2021
%Y A051933 Cf. A224915 (row sums), A003987 (array), A051910 (Nim-product).
%Y A051933 Other triangles: A080099 (AND), A080098 (OR), A265705 (IMPL), A102037 (CNIMPL), A002262 (k).
%K A051933 tabl,nonn,easy,nice,hear,look
%O A051933 0,4
%A A051933 _N. J. A. Sloane_, Dec 20 1999
%E A051933 More terms from Michael Lugo (mlugo(AT)thelabelguy.com), Dec 22 1999