cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A054868 #41 Jul 03 2024 10:05:11
%S A054868 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 A054868 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 A054868 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 A054868 Sum of bits of sum of bits of n: a(n) = wt(wt(n)).
%H A054868 Reinhard Zumkeller, <a href="/A054868/b054868.txt">Table of n, a(n) for n = 0..10000</a>
%H A054868 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 A054868 Michael Gilleland, <a href="/selfsimilar.html">Some Self-Similar Integer Sequences</a>.
%H A054868 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>.
%F A054868 a(n) = A000120(A000120(n)).
%F A054868 a(2^(2^n-1)-1) = a(A077585(n)) = n (first occurrence). - _Alois P. Heinz_, Jul 04 2022
%e A054868 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 A054868 a:= n-> (w-> w(w(n)))(k-> add(i, i=Bits[Split](k))):
%p A054868 seq(a(n), n=0..100);  # _Alois P. Heinz_, Jul 04 2022
%t A054868 a[n_] := DigitCount[DigitCount[n, 2, 1], 2, 1]; Array[a, 100, 0] (* _Amiram Eldar_, Jul 24 2023 *)
%o A054868 (PARI) a(n) = norml2(binary(norml2(binary(n))))  \\ _Michel Marcus_, May 25 2013
%o A054868 (PARI) a(n) = hammingweight(hammingweight(n)); \\ _Ruud H.G. van Tol_, Jul 03 2024
%o A054868 (Haskell)
%o A054868 a054868 = a000120 . a000120  -- _Reinhard Zumkeller_, Mar 31 2015
%o A054868 (Python)
%o A054868 def a(n): return n.bit_count().bit_count()
%o A054868 print([a(n) for n in range(99)]) # _Michael S. Branicky_, Jul 04 2022
%Y A054868 Cf. A000120, A077585 (where records occur), A089224.
%K A054868 nonn,base,easy
%O A054868 0,8
%A A054868 _Jeffrey Shallit_, May 15 2000