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.

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

This page as a plain text file.
%I A283987 #15 May 05 2023 12:32:33
%S A283987 1,0,3,3,2,1,1,2,5,7,6,7,7,6,7,5,4,1,3,4,11,13,2,5,5,2,13,11,4,3,1,4,
%T A283987 7,3,12,13,15,12,13,9,8,3,5,8,9,11,14,11,11,14,11,9,8,5,3,8,9,13,12,
%U A283987 15,13,12,3,7,6,1,13,14,11,7,4,9,11,4,25,21,22,27,7,14,13,5,24,27,29,24,31,23,20,29,31,20,23,25,2,9,9,2,25,23,20,31,29,20,23
%N A283987 a(n) = A002487(n-1) XOR A002487(n), where XOR is bitwise-xor (A003987).
%H A283987 Antti Karttunen, <a href="/A283987/b283987.txt">Table of n, a(n) for n = 1..8192</a>
%H A283987 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A283987 a(n) = A002487(n-1) XOR A002487(n), where XOR is bitwise-xor (A003987).
%F A283987 a(n) = A283986(n) - A283988(n).
%F A283987 a(n) = A007306(n) - 2*A283988(n).
%F A283987 a(n) = A283977((2*n)-1).
%t A283987 a[0] = 0; a[1] = 1; a[n_] := If[EvenQ@ n, a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Table[BitXor[a[n - 1], a@ n], {n, 120}] (* _Michael De Vlieger_, Mar 22 2017 *)
%o A283987 (Scheme) (define (A283987 n) (A003987bi (A002487 (- n 1)) (A002487 n))) ;; Where A003987bi implements bitwise-XOR (A003987).
%o A283987 (PARI) A(n) = if(n<2, n, if(n%2, A(n\2) + A((n + 1)/2), A(n/2)));
%o A283987 for(n=1, 120, print1(bitxor(A(n - 1), A(n)), ", ")) \\ _Indranil Ghosh_, Mar 23 2017
%o A283987 (Python)
%o A283987 from functools import reduce
%o A283987 def A283987(n): return sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n)[-1:2:-1],(1,0)))^sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n-1)[-1:2:-1],(1,0))) if n>1 else 1 # _Chai Wah Wu_, May 05 2023
%Y A283987 Odd bisection of A283977.
%Y A283987 Cf. A002487, A003987, A283988.
%Y A283987 Cf. A283973 (positions where coincides with A007306, or equally, with A283986).
%K A283987 nonn,base
%O A283987 1,3
%A A283987 _Antti Karttunen_, Mar 21 2017