Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
a(1)=1; for n >= 2, a(n) = Sum_{i=1..A000120(n)} a(z(i)), where z(i) are the positions of 1's in the binary expansion of n, counted from left to right.
2

%I #20 Jul 24 2023 02:35:31

%S 1,1,2,1,3,2,4,1,2,3,4,2,3,4,5,1,4,2,5,3,6,4,7,2,5,3,6,4,7,5,8,1,3,4,

%T 6,2,4,5,7,3,5,6,8,4,6,7,9,2,4,5,7,3,5,6,8,4,6,7,9,5,7,8,10,1,5,3,7,4,

%U 8,6,10,2,6,4,8,5,9,7,11,3,7,5,9,6,10,8,12,4,8,6,10,7,11,9,13,2,6,4

%N a(1)=1; for n >= 2, a(n) = Sum_{i=1..A000120(n)} a(z(i)), where z(i) are the positions of 1's in the binary expansion of n, counted from left to right.

%H Amiram Eldar, <a href="/A323355/b323355.txt">Table of n, a(n) for n = 1..10000</a>

%e n=13, decimal 13 is 1101 in binary, the 1's are at positions 1,2,4. So a(13) = a(1) + a(2) + a(4).

%t a[1] = 1; a[n_] := a[n] = Total[a /@ (Position[IntegerDigits[n, 2], 1] // Flatten)]; Array[a, 100] (* _Amiram Eldar_, Jul 24 2023 *)

%o (PARI) lista(nn) = {my(va = vector(nn), vb); va[1] = 1; for (n=2, nn, vb = binary(n); va[n] = sum(k=1, #vb, vb[k]*va[k]);); va;} \\ _Michel Marcus_, Jan 12 2019

%Y Cf. A007088, A000120.

%K base,nonn

%O 1,3

%A _Ctibor O. Zizka_, Jan 12 2019