[go: up one dir, main page]

login
Table of x AND y, where (x,y) = (0,0),(0,1),(1,0),(0,2),(1,1),(2,0),...
96

%I #36 May 28 2021 20:01:21

%S 0,0,0,0,1,0,0,0,0,0,0,1,2,1,0,0,0,2,2,0,0,0,1,0,3,0,1,0,0,0,0,0,0,0,

%T 0,0,0,1,2,1,4,1,2,1,0,0,0,2,2,4,4,2,2,0,0,0,1,0,3,4,5,4,3,0,1,0,0,0,

%U 0,0,4,4,4,4,0,0,0,0,0,1,2,1,0,5,6,5,0,1,2,1,0,0,0,2,2,0,0,6,6,0,0,2,2,0,0,0,1,0

%N Table of x AND y, where (x,y) = (0,0),(0,1),(1,0),(0,2),(1,1),(2,0),...

%C Or, table of AND(i,j), i >= 0, j >= 0, read by antidiagonals. - _N. J. A. Sloane_, Feb 08 2016

%C Or, table of (i+j-Nimsum(i,j))/2) read by antidiagonals [Winning Ways, p. 75]. - _N. J. A. Sloane_, Feb 22 2019

%D E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 75.

%H T. D. Noe, <a href="/A004198/b004198.txt">Rows n=0..100 of triangle, flattened</a>

%e The AND(i,j) table (shown without commas or spaces) begins:

%e 0000000000000000000000000...

%e 0101010101010101010101010...

%e 0022002200220022002200220...

%e 0123012301230123012301230...

%e 0000444400004444000044440...

%e 0101454501014545010145450...

%e 0022446600224466002244660...

%e 0123456701234567012345670...

%e 0000000088888888000000008...

%e 0101010189898989010101018...

%e ...

%e The first few antidiagonals are:

%e 0,

%e 0, 0,

%e 0, 1, 0,

%e 0, 0, 0, 0,

%e 0, 1, 2, 1, 0,

%e 0, 0, 2, 2, 0, 0,

%e 0, 1, 0, 3, 0, 1, 0,

%e 0, 0, 0, 0, 0, 0, 0, 0,

%e 0, 1, 2, 1, 4, 1, 2, 1, 0,

%e 0, 0, 2, 2, 4, 4, 2, 2, 0, 0,

%e 0, 1, 0, 3, 4, 5, 4, 3, 0, 1, 0,

%e ...

%e - _N. J. A. Sloane_, Feb 08 2016

%p # Maple code for first M rows and columns of AND(i,j) table

%p M:=24;

%p f1:=n->[seq(ANDnos(i,n),i=0..M-1)];

%p for n from 0 to M-1 do lprint(f1(n)); od:

%p # _N. J. A. Sloane_, Feb 08 2016

%t Table[BitAnd[k, n - k], {n, 0, 20}, {k, 0, n}] // Flatten (* _Indranil Ghosh_, Apr 01 2017 *)

%o (PARI)

%o tabl(nn) = {for(n=0, nn, for(k=0, n, print1(bitand(k, n - k), ", "); ); print(); ); };

%o tabl(20) \\ _Indranil Ghosh_, Apr 01 2017

%o (Python)

%o for n in range(21):

%o print([k&(n - k) for k in range(n + 1)])

%o # _Indranil Ghosh_, Apr 01 2017

%o (C)

%o #include <stdio.h>

%o int main()

%o {

%o int n, k;

%o for (n=0; n<=20; n++){

%o for(k=0; k<=n; k++){

%o printf("%d, ", (k&(n - k)));

%o }

%o printf("\n");

%o }

%o return 0;

%o } /* _Indranil Ghosh_, Apr 01 2017 */

%Y Cf. A003986 (OR) and A003987 (XOR). Cf. also A075173, A075175, A221146.

%K tabl,nonn,look

%O 0,13

%A _David W. Wilson_