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!)
A054868 Sum of bits of sum of bits of n: a(n) = wt(wt(n)). 4

%I #35 Jul 24 2023 02:37:01

%S 0,1,1,1,1,1,1,2,1,1,1,2,1,2,2,1,1,1,1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,1,

%T 1,2,1,2,2,1,1,2,2,1,2,1,1,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,1,1,1,2,

%U 1,2,2,1,1,2,2,1,2,1,1,2,1,2,2,1,2,1,1,2,2,1,1,2,1,2,2,2,1,2,2

%N Sum of bits of sum of bits of n: a(n) = wt(wt(n)).

%H Reinhard Zumkeller, <a href="/A054868/b054868.txt">Table of n, a(n) for n = 0..10000</a>

%H Richard Bellman and Harold N. Shapiro, <a href="http://www.jstor.org/stable/1969281">On a problem in additive number theory</a>, Annals Math., 49 (1948), 333-340.

%H Michael Gilleland, <a href="/selfsimilar.html">Some Self-Similar Integer Sequences</a>.

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

%F a(n) = A000120(A000120(n)).

%F a(2^(2^n-1)-1) = a(A077585(n)) = n (first occurrence). - _Alois P. Heinz_, Jul 04 2022

%e a(127) = 3 since 127 in base 2 is 1111111, whose sum of bits is 7 and 7 in base 2 is 111, whose sum of bits is 3.

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

%p seq(a(n), n=0..100); # _Alois P. Heinz_, Jul 04 2022

%t a[n_] := DigitCount[DigitCount[n, 2, 1], 2, 1]; Array[a, 100, 0] (* _Amiram Eldar_, Jul 24 2023 *)

%o (PARI) a(n) = norml2(binary(norml2(binary(n)))) \\ _Michel Marcus_, May 25 2013

%o (Haskell)

%o a054868 = a000120 . a000120 -- _Reinhard Zumkeller_, Mar 31 2015

%o (Python)

%o def a(n): return n.bit_count().bit_count()

%o print([a(n) for n in range(99)]) # _Michael S. Branicky_, Jul 04 2022

%Y Cf. A000120, A077585 (where records occur), A089224.

%K nonn,base

%O 0,8

%A _Jeffrey Shallit_, May 15 2000

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 19 23:40 EDT 2024. Contains 371798 sequences. (Running on oeis4.)