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.

A326816 a(0) = 0, a(1) = 1, and for n > 1, a(n) = Sum_{k = 0..n} a((n-k) AND k) (where AND denotes the bitwise AND operator).

Original entry on oeis.org

0, 1, 1, 0, 3, 2, 2, 0, 9, 10, 10, 12, 12, 8, 4, 0, 27, 38, 46, 60, 66, 68, 72, 72, 90, 84, 76, 72, 44, 24, 8, 0, 81, 130, 182, 228, 302, 332, 384, 360, 526, 572, 636, 600, 624, 576, 568, 432, 764, 888, 996, 1008, 972, 936, 888, 864, 712, 560, 408, 320, 144
Offset: 0

Views

Author

Rémy Sigrist, Oct 20 2019

Keywords

Comments

This sequence combines features of A006581 and of A007461.

Examples

			a(2) = a(2 AND 0) + a(1 AND 1) + a(0 AND 2) = a(0) + a(1) + a(0) = 1.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          add(a(Bits[And](n-k, k)), k=0..n))
        end:
    seq(a(n), n=0..80);  # Alois P. Heinz, Oct 20 2019
  • PARI
    a = vector(61); for (n=0, #a-1, print1 (a[1+n] = if (n==0, 0, n==1, 1, sum (k=0, n, a[1+bitand(n-k,k)])) ", "))

Formula

a(n) is odd iff n is a power of 2.
a(n) = 0 iff n = 2^k with k = 0 or k = 2.
a(2^k) = 3^(k-1) for any k > 0.
a(2^k+1) = A056182(k-1) for any k > 1.