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

%I #17 Nov 19 2019 05:51:35

%S 1,2,3,5,10,12,17,29,58,60,65,77,106,166,243,409,818,820,825,837,866,

%T 926,1003,1169,1578,2398,3235,4161,5330,7728,11889,19617,39234,39236,

%U 39241,39253,39282,39342,39419,39585,39994,40814

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

%H Ivan Neretin, <a href="/A050051/b050051.txt">Table of n, a(n) for n = 1..8193</a>

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

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

%p end proc:

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

%t Fold[Append[#1, #1[[-1]] + #1[[#2]]] &, {1, 2, 3}, Flatten@Table[2 k, {n, 5}, {k, 2^n}]] (* _Ivan Neretin_, Sep 06 2015 *)

%Y Cf. A050027, A050031, A050035, A050039, A050043, A050047, A050055, A050059, A050063, A050067, A050071 (similar, but with different initial conditions).

%K nonn

%O 1,2

%A _Clark Kimberling_

%E Name edited by _Petros Hadjicostas_, Nov 18 2019