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

%I #12 Nov 16 2019 03:24:01

%S 1,3,3,6,10,22,42,77,122,285,568,1129,2226,4372,8298,14938,23804,

%T 55905,111808,223609,447186,894292,1788138,3574618,7143164,14270822,

%U 28453640,56571902,111802852,218250678,415190880,747032548,1190677068

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

%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 < 3, [1, 3][n], s(n - 1) - a(-2^ceil(log[2](n - 1)) + 2*n - 3)):

%p end proc:

%p seq(a(n), n = 1..40); # _Petros Hadjicostas_, Nov 15 2019

%K nonn

%O 1,2

%A _Clark Kimberling_

%E Name edited by _Petros Hadjicostas_, Nov 15 2019