login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A283977
a(2n) = A002487(n), a(2n+1) = A002487(n) XOR A002487(n+1), where XOR is bitwise-xor (A003987).
4
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,6
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).
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 *)
PROG
(Scheme) (define (A283977 n) (if (even? n) (A002487 n) (A003987bi (A002487 (/ (- n 1) 2)) (A002487 (/ (+ n 1) 2))))) ;; Where A003987bi implements bitwise-XOR (A003987).
(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
CROSSREFS
Bisections: A002487, A283987.
Sequence in context: A200223 A236228 A082391 * A248579 A296992 A304783
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Mar 21 2017
STATUS
approved