|
|
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
|
|
|
FORMULA
|
|
|
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))):
|
|
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)
(Python)
def a(n): return n.bit_count().bit_count()
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|