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.

Showing 1-2 of 2 results.

A099026 Array x AND NOT y, read by rising antidiagonals.

Original entry on oeis.org

0, 1, 0, 2, 0, 0, 3, 2, 1, 0, 4, 2, 0, 0, 0, 5, 4, 1, 0, 1, 0, 6, 4, 4, 0, 2, 0, 0, 7, 6, 5, 4, 3, 2, 1, 0, 8, 6, 4, 4, 0, 2, 0, 0, 0, 9, 8, 5, 4, 1, 0, 1, 0, 1, 0, 10, 8, 8, 4, 2, 0, 0, 0, 2, 0, 0, 11, 10, 9, 8, 3, 2, 1, 0, 3, 2, 1, 0, 12, 10, 8, 8, 8, 2, 0, 0, 4, 2, 0, 0, 0, 13, 12, 9, 8, 9, 8, 1
Offset: 0

Views

Author

Ralf Stephan, Sep 26 2004

Keywords

Comments

For n>0, the n-th row and the differences of the n-th column have period 2^floor(log_(n)+1).

Examples

			0,0,0,0,0,0,
1,0,1,0,1,0,
2,2,0,0,2,2,
3,2,1,0,3,2,
4,4,4,4,0,0,
5,4,5,4,1,0,
		

Crossrefs

Rows include A000004, A059841. Columns include A001477, A052928. Antidiagonal sums are in A099027.
Cf. A003985 (AND), A003986 (OR), A003987 (XOR).

Programs

  • Mathematica
    Table[BitAnd[x - y, BitNot[y]], {x, 0, 15}, {y, 0, x}] (* Paolo Xausa, Sep 30 2024 *)
  • PARI
    T(x,y)=bitnegimply(x,y)

Formula

T(x, y) = x AND NOT y. The AND NOT operation satisfies the bitwise truth table: (0, 0) = 0, (0, 1) = 0, (1, 0) = 1, (1, 1) = 0.

A375551 a(n) = Sum_{k=0..n} k XOR n-k, where XOR is the bitwise exclusive disjunction. Row sums of A003987.

Original entry on oeis.org

0, 2, 4, 12, 12, 22, 32, 56, 48, 58, 68, 100, 108, 142, 176, 240, 208, 210, 212, 252, 252, 294, 336, 424, 416, 458, 500, 596, 636, 734, 832, 992, 896, 866, 836, 876, 844, 886, 928, 1048, 1008, 1050, 1092, 1220, 1260, 1390, 1520, 1744, 1680, 1714, 1748, 1884, 1916
Offset: 0

Views

Author

Peter Luschny, Sep 27 2024

Keywords

Crossrefs

Programs

  • Maple
    XOR := (n, k) -> Bits:-Xor(n, k):
    a := n -> local k; add(XOR(k, n-k), k=0..n):
    seq(a(n), n = 0..52);
  • Mathematica
    (* Using definition *)
    Table[Sum[BitXor[n - k, k], {k, 0, n}], {n, 0, 100}]
    (* Using recurrence -- faster *)
    a[0] = 0; a[n_] := a[n] = If[OddQ[n], 4*a[(n-1)/2] + n + 1, 2*(a[n/2] + a[n/2-1])];
    Table[a[n], {n, 0, 100}] (* Paolo Xausa, Oct 01 2024 *)
  • PARI
    a(n) = sum(k=0, n, bitxor(k, n-k)); \\ Michel Marcus, Sep 28 2024

Formula

a(n) = 2*A099027(n).
a(n) = 2*n + A006582(n).
a(2^n - 1) = 4^n - 2^n = A020522(n).
a(2^n) = 4^n - 2^n*(n - 1) = 2*A376585(n).
Recurrence: a(0) = 0; a(2*n) = 2*(a(n) + a(n-1)); a(2*n+1) = 2*(2*a(n) + n + 1). - Paolo Xausa, Oct 01 2024, derived from recurrence in A099027.
Showing 1-2 of 2 results.