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.

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

Original entry on oeis.org

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

Views

Author

Keywords

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

Examples

			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
		

References

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

Crossrefs

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

Programs

  • C
    #include 
    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 */
  • 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 *)
  • 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