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.

A283977 a(2n) = A002487(n), a(2n+1) = A002487(n) XOR A002487(n+1), where XOR is bitwise-xor (A003987).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Mar 21 2017

Keywords

Crossrefs

Bisections: A002487, A283987.

Programs

  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := If[EvenQ@ n, a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Table[If[EvenQ@ n, a[n/2], BitXor[a[#], a[# + 1]] &[(n - 1)/2]], {n, 0, 112}] (* Michael De Vlieger, Mar 22 2017 *)
  • PARI
    A(n) = if(n<2, n, if(n%2, A(n\2) + A((n + 1)/2), A(n/2)));
    a(n) = if(n<2, n, if(n%2, bitxor(A(n\2), A((n + 1)/2)), A(n\2)));
    for(n=0, 120, print1(a(n), ", ")) \\ Indranil Ghosh, Mar 23 2017
  • Scheme
    (define (A283977 n) (if (even? n) (A002487 n) (A003987bi (A002487 (/ (- n 1) 2)) (A002487 (/ (+ n 1) 2))))) ;; Where A003987bi implements bitwise-XOR (A003987).
    

Formula

a(2n) = A002487(2n) = A002487(n), a(2n+1) = A002487(n) XOR A002487(n+1), where XOR is bitwise-xor (A003987).
a(n) = A283976(n) - A283978(n).
a(n) = A002487(n) - 2*A283978(n).