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
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,8
LINKS
Richard Bellman and Harold N. Shapiro, On a problem in additive number theory, Annals Math., 49 (1948), 333-340.
FORMULA
a(n) = A000120(A000120(n)).
a(2^(2^n-1)-1) = a(A077585(n)) = n (first occurrence). - Alois P. Heinz, Jul 04 2022
EXAMPLE
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.
MAPLE
a:= n-> (w-> w(w(n)))(k-> add(i, i=Bits[Split](k))):
seq(a(n), n=0..100); # Alois P. Heinz, Jul 04 2022
MATHEMATICA
a[n_] := DigitCount[DigitCount[n, 2, 1], 2, 1]; Array[a, 100, 0] (* Amiram Eldar, Jul 24 2023 *)
PROG
(PARI) a(n) = norml2(binary(norml2(binary(n)))) \\ Michel Marcus, May 25 2013
(Haskell)
a054868 = a000120 . a000120 -- Reinhard Zumkeller, Mar 31 2015
(Python)
def a(n): return n.bit_count().bit_count()
print([a(n) for n in range(99)]) # Michael S. Branicky, Jul 04 2022
CROSSREFS
Cf. A000120, A077585 (where records occur), A089224.
Sequence in context: A319608 A230850 A072085 * A352517 A347981 A065081
KEYWORD
nonn,base
AUTHOR
Jeffrey Shallit, May 15 2000
STATUS
approved

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 June 27 04:08 EDT 2024. Contains 373727 sequences. (Running on oeis4.)