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!)
A352784 a(n) = w(n - w(n)), where w(n) is the binary weight of n, A000120(n). 2

%I #17 Nov 29 2022 11:30:48

%S 0,0,1,1,2,2,1,1,3,3,1,1,2,2,3,3,4,4,1,1,2,2,3,3,3,3,4,4,3,3,3,3,5,5,

%T 1,1,2,2,3,3,3,3,4,4,3,3,3,3,4,4,5,5,3,3,3,3,4,4,4,4,3,3,4,4,6,6,1,1,

%U 2,2,3,3,3,3,4,4,3,3,3,3,4,4,5,5,3,3,3,3,4,4,4,4,3,3,4,4,5,5,6,6,3,3,3,3,4,4,4,4

%N a(n) = w(n - w(n)), where w(n) is the binary weight of n, A000120(n).

%H Michael S. Branicky, <a href="/A352784/b352784.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = A000120(n - A000120(n)); a(n) = A000120(A011371(n)).

%F a(n) = A280700(floor(n/2)). - _Georg Fischer_, Nov 29 2022

%e a(8) = A000120(8 - A000120(8)) = 3.

%p a:= n-> (w-> w(n-w(n)))(k-> add(i, i=Bits[Split](k))):

%p seq(a(n), n=0..120); # _Alois P. Heinz_, May 24 2022

%t w[n_] := DigitCount[n, 2, 1]; a[n_] := w[n - w[n]]; Array[a, 100, 0] (* _Amiram Eldar_, Apr 02 2022 *)

%o (Python)

%o def w(n): return bin(n).count("1")

%o def a(n): return w(n - w(n))

%o print([a(n) for n in range(108)]) # _Michael S. Branicky_, Apr 02 2022

%Y Cf. A000120, A011371, A280700.

%K nonn,base,easy

%O 0,5

%A _Ctibor O. Zizka_, Apr 02 2022

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 August 7 17:47 EDT 2024. Contains 375017 sequences. (Running on oeis4.)