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.

A283986 a(n) = A002487(n-1) OR A002487(n), where OR is bitwise-or (A003986).

This page as a plain text file.
%I A283986 #15 May 05 2023 12:31:51
%S A283986 1,1,3,3,3,3,3,3,5,7,7,7,7,7,7,5,5,5,7,7,11,13,7,7,7,7,13,11,7,7,5,5,
%T A283986 7,7,13,13,15,15,15,11,11,11,13,13,13,15,15,11,11,15,15,13,13,13,11,
%U A283986 11,11,15,15,15,13,13,7,7,7,7,15,15,15,15,13,13,15,15,27,23,23,27,15,15,15,15,27,27,29,29,31,23,21,29,31,23,23,25,11,11,11,11,25
%N A283986 a(n) = A002487(n-1) OR A002487(n), where OR is bitwise-or (A003986).
%H A283986 Antti Karttunen, <a href="/A283986/b283986.txt">Table of n, a(n) for n = 1..8192</a>
%H A283986 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A283986 a(n) = A002487(n-1) OR A002487(n), where OR is bitwise-or (A003986).
%F A283986 a(n) = A283987(n) + A283988(n).
%F A283986 a(n) = A007306(n) - A283988(n).
%F A283986 a(n) = A283976((2*n)-1).
%t A283986 a[0] = 0; a[1] = 1; a[n_] := If[EvenQ@ n, a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Table[BitOr[a[n - 1], a@ n], {n, 120}] (* _Michael De Vlieger_, Mar 22 2017 *)
%o A283986 (Scheme) (define (A283986 n) (A003986bi (A002487 (- n 1)) (A002487 n))) ;; Where A003986bi implements bitwise-OR (A003986).
%o A283986 (PARI) A(n) = if(n<2, n, if(n%2, A(n\2) + A((n + 1)/2), A(n/2)));
%o A283986 for(n=1, 101, print1(bitor(A(n - 1), A(n))", ")) \\ _Indranil Ghosh_, Mar 23 2017
%o A283986 (Python)
%o A283986 from functools import reduce
%o A283986 def A283986(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))) # _Chai Wah Wu_, May 05 2023
%Y A283986 Odd bisection of A283976.
%Y A283986 Cf. A002487, A003986, A283988.
%Y A283986 Cf. A283973 (positions where coincides with A007306, equally, with A283987).
%K A283986 nonn,base
%O A283986 1,3
%A A283986 _Antti Karttunen_, Mar 21 2017