login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A283998 a(n) = n AND A005187(floor(n/2)), where AND is bitwise-and (A004198). 3

%I #16 May 08 2021 23:05:57

%S 0,0,0,1,0,1,4,4,0,1,8,8,8,8,10,11,0,1,16,16,16,16,18,19,16,16,18,19,

%T 24,25,26,26,0,1,32,32,32,32,34,35,32,32,34,35,40,41,42,42,32,32,34,

%U 35,48,49,50,50,48,49,50,50,56,56,56,57,0,1,64,64,64,64,66,67,64,64,66,67,72,73,74,74,64,64,66,67,80,81,82,82,80,81,82,82,88,88,88,89

%N a(n) = n AND A005187(floor(n/2)), where AND is bitwise-and (A004198).

%H Antti Karttunen, <a href="/A283998/b283998.txt">Table of n, a(n) for n = 0..8192</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = n AND A005187(floor(n/2)), where AND is bitwise-and (A004198).

%F a(n) = A283996(n) - A283997(n).

%F a(n) = A005187(n) - A283996(n) = (A005187(n) - A283997(n))/2.

%t A[n_]:=2*n - DigitCount[2*n, 2, 1];Table[BitAnd[n, A[Floor[n/2]]], {n, 0, 100}] (* _Indranil Ghosh_, Mar 25 2017 *)

%o (Scheme) (define (A283998 n) (A004198bi n (A005187 (floor->exact (/ n 2))))) ;; Where A004198bi implements bitwise-AND (A004198).

%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(bitand(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. A004198, A005187, A283996, A283997.

%K nonn,base

%O 0,7

%A _Antti Karttunen_, Mar 19 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)