%I #40 Jul 27 2023 09:35:18
%S 1,1,1,2,2,3,2,2,3,2,3,3,3,3,5,2,3,3,3,5,3,5,4,1,2,3,3,3,3,5,3,5,4,2,
%T 3,4,4,5,4,5,6,2,3,3,3,3,5,3,5,4,2,3,4,4,5,4,5,6,3,3,5,4,3,5,4,5,4,5,
%U 5,7,6,6,2,2,3,3,3,5,3,5,4,2,3,4,4,5,4,5,6,3,3,5,4,3,5,4,5,4,5,5,7,6,6
%N a(1) = 1, a(n) = hamming_weight(Sum_{k=1..n-1} a(k) ) for n>=2.
%H Alois P. Heinz, <a href="/A309674/b309674.txt">Table of n, a(n) for n = 1..100000</a>
%F a(n) = A010062(n-1) - A010062(n-2) for n>1. - _Jon Maiga_, Aug 30 2019
%p b:= proc(n) option remember; `if`(n=0, 0, a(n)+b(n-1)) end:
%p a:= n-> `if`(n=1, 1, add(i, i=Bits[Split](b(n-1)))):
%p seq(a(n), n=1..120); # _Alois P. Heinz_, Aug 30 2019
%t a[1] = 1; s[n_] := Sum[a[k], {k, 1, n - 1}]; a[n_] := a[n] = DigitCount[s[n], 2, 1]; Array[a, 100] (* _Amiram Eldar_, Jul 27 2023 *)
%o (PARI) { my(s=0,t=1); for(j=1,100, print1(t,", "); s+=t;t=hammingweight(s)); } \\ _Joerg Arndt_, Aug 30 2019
%Y Cf. A000120, A010062.
%K nonn,base
%O 1,4
%A _Petr Stanicek_, Aug 22 2019