login
A004198
Table of x AND y, where (x,y) = (0,0),(0,1),(1,0),(0,2),(1,1),(2,0),...
96
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, 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, 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
OFFSET
0,13
COMMENTS
Or, table of AND(i,j), i >= 0, j >= 0, read by antidiagonals. - N. J. A. Sloane, Feb 08 2016
Or, table of (i+j-Nimsum(i,j))/2) read by antidiagonals [Winning Ways, p. 75]. - N. J. A. Sloane, Feb 22 2019
REFERENCES
E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 75.
EXAMPLE
The AND(i,j) table (shown without commas or spaces) begins:
0000000000000000000000000...
0101010101010101010101010...
0022002200220022002200220...
0123012301230123012301230...
0000444400004444000044440...
0101454501014545010145450...
0022446600224466002244660...
0123456701234567012345670...
0000000088888888000000008...
0101010189898989010101018...
...
The first few antidiagonals are:
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, 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,
...
- N. J. A. Sloane, Feb 08 2016
MAPLE
# Maple code for first M rows and columns of AND(i, j) table
M:=24;
f1:=n->[seq(ANDnos(i, n), i=0..M-1)];
for n from 0 to M-1 do lprint(f1(n)); od:
# N. J. A. Sloane, Feb 08 2016
MATHEMATICA
Table[BitAnd[k, n - k], {n, 0, 20}, {k, 0, n}] // Flatten (* Indranil Ghosh, Apr 01 2017 *)
PROG
(PARI)
tabl(nn) = {for(n=0, nn, for(k=0, n, print1(bitand(k, n - k), ", "); ); print(); ); };
tabl(20) \\ Indranil Ghosh, Apr 01 2017
(Python)
for n in range(21):
print([k&(n - k) for k in range(n + 1)])
# Indranil Ghosh, Apr 01 2017
(C)
#include <stdio.h>
int main()
{
int n, k;
for (n=0; n<=20; n++){
for(k=0; k<=n; k++){
printf("%d, ", (k&(n - k)));
}
printf("\n");
}
return 0;
} /* Indranil Ghosh, Apr 01 2017 */
CROSSREFS
Cf. A003986 (OR) and A003987 (XOR). Cf. also A075173, A075175, A221146.
Sequence in context: A275948 A356325 A073253 * A350673 A324351 A116402
KEYWORD
tabl,nonn,look
STATUS
approved