login
a(n) = a(1) + a(2) + ... + a(n-1) + a(m) for n >= 4, where m = n - 1 - 2^p and p is the unique integer such that 2^p < n - 1 <= 2^(p+1), starting with a(1) = a(2) = a(3) = 1.
3

%I #19 May 06 2022 13:12:16

%S 1,1,1,4,8,16,32,64,131,259,518,1036,2075,4154,8316,16648,33328,66593,

%T 133186,266372,532747,1065498,2131004,4262024,8524080,17048227,

%U 34096582,68193423,136387364,272775767,545553613,1091111388,2182231108

%N a(n) = a(1) + a(2) + ... + a(n-1) + a(m) for n >= 4, where m = n - 1 - 2^p and p is the unique integer such that 2^p < n - 1 <= 2^(p+1), starting with a(1) = a(2) = a(3) = 1.

%p s := proc(n) option remember; `if`(n < 1, 0, a(n) + s(n - 1)) end proc:

%p a := proc(n) option remember;

%p `if`(n < 4, [1, 1, 1][n], s(n - 1) + a(-2^ceil(-1 + log[2](n - 1)) + n - 1)):

%p end proc:

%p seq(a(n), n = 1..40); # _Petros Hadjicostas_, Apr 25 2020

%o (PARI) lista(nn) = { my(va = vector(nn)); va[1] = 1; va[2] = 1; va[3] = 1; my(sa = vecsum(va)); for (n=4, nn, va[n] = sa + va[n - 1 - 2^ceil(-1 + log(n-1)/log(2))]; sa += va[n]; ); va; } \\ _Petros Hadjicostas_, Apr 26 2020 (with nn > 2)

%Y Cf. A049886 (similar, but with minus a(m)), A049887 (similar, but with minus a(2*m)), A049935 (similar, but with plus a(2*m)).

%K nonn

%O 1,4

%A _Clark Kimberling_

%E Name edited by _Petros Hadjicostas_, Apr 25 2020