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”).
%I #19 May 08 2021 23:05:52
%S 0,1,3,3,7,7,6,7,15,15,10,11,14,15,15,15,31,31,18,19,22,23,23,23,30,
%T 31,31,31,29,29,30,31,63,63,34,35,38,39,39,39,46,47,47,47,45,45,46,47,
%U 62,63,63,63,53,53,54,55,61,61,62,63,60,61,63,63,127,127,66,67,70,71,71,71,78,79,79,79,77,77,78,79,94,95,95,95,85,85,86,87,93,93,94,95
%N a(n) = n OR A005187(floor(n/2)), where OR is bitwise-or (A003986).
%H Antti Karttunen, <a href="/A283996/b283996.txt">Table of n, a(n) for n = 0..8191</a>
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F a(n) = n OR A005187(floor(n/2)), where OR is bitwise-or (A003986).
%F a(n) = A283997(n) + A283998(n).
%F a(n) = A005187(n) - A283998(n).
%t A[n_]:=2*n - DigitCount[2*n, 2, 1]; Table[BitOr[n, A[Floor[n/2]]], {n,0,100}] (* _Indranil Ghosh_, Mar 25 2017 *)
%o (Scheme) (define (A283996 n) (A003986bi n (A005187 (floor->exact (/ n 2))))) ;; Where A003986bi implements bitwise-OR (A003986).
%o (PARI) b(n) = if(n<1, 0, b(n\2) + n%2);
%o A(n) = 2*n - b(2*n);
%o for(n=0, 100, print1(bitor(n, A(floor(n/2))),", ")) \\ _Indranil Ghosh_, Mar 25 2017
%o (Python)
%o def A(n): return 2*n - bin(2*n)[2:].count("1")
%o print([n|A(n//2) for n in range(101)]) # _Indranil Ghosh_, Mar 25 2017
%Y Cf. A003986, A005187, A283997, A283998.
%K nonn,base
%O 0,3
%A _Antti Karttunen_, Mar 19 2017