A323355 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.
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, 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, 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
Offset: 1
Examples
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).
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
a[1] = 1; a[n_] := a[n] = Total[a /@ (Position[IntegerDigits[n, 2], 1] // Flatten)]; Array[a, 100] (* Amiram Eldar, Jul 24 2023 *)
-
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