%I #32 Apr 23 2020 10:00:10
%S 1,1,3,6,14,26,54,119,278,503,1008,2027,4094,8412,17554,38194,89848,
%T 162143,324288,648587,1297214,2594652,5190034,10383154,20779768,
%U 41631830,83498100,167969126,339831072,695251878,1453222088,3162777148,7438945312,13424668537,26849337076,53698674163
%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) with a(1) = a(2) = 1.
%H Alois P. Heinz, <a href="/A049940/b049940.txt">Table of n, a(n) for n = 1..3320</a>
%F a(n) = a(2*n - 3 - 2^ceiling(log_2(n-1))) + Sum_{i = 1..n-1} a(i) = a(A006257(n-2)) + Sum_{i = 1..n-1} a(i) for n >= 3 with a(1) = a(2) = 1. - _Petros Hadjicostas_, Sep 24 2019
%e From _Petros Hadjicostas_, Sep 24 2019: (Start)
%e a(3) = a(1) + a(2) + a(m=1) = 1 + 1 + 1 = 3 because m = A006257(3-2) = 2*3 - 3 - 2^ceiling(log[2](3-1)) = 1.
%e a(4) = a(1) + a(2) + a(3) + a(m=1) = 1 + 1 + 3 + 1 = 6 because m = A006257(4-2) = 2*4 - 3 - 2^ceiling(log[2](4-1)) = 1.
%e a(5) = a(1) + a(2) + a(3) + a(4) + a(m=3) = 1 + 1 + 3 + 6 + 3 = 14 because m = A006257(5-2) = 2*5 - 3 - 2^ceiling(log[2](5-1)) = 3.
%e a(6) = a(1) + a(2) + a(3) + a(4) + a(5) + a(m=1) = 1 + 1 + 3 + 6 + 14 + 1 = 26 because m = A006257(6-2) = 2*6 - 3 - 2^ceiling(log[2](6-1)) = 1.
%e (End)
%p a := proc(n) local vv, i; option remember; if n = 1 then vv := 1; end if; if n = 2 then vv := 1; end if; if 3 <= n then vv := 0; for i to n - 1 do vv := vv + a(i); end do; vv := vv + a(2*n - 3 - 2^ceil(log[2](n - 1))); end if; vv; end proc; # _Petros Hadjicostas_, Sep 24 2019
%p # second Maple program:
%p s:= proc(n) option remember; `if`(n<1, 0, a(n)+s(n-1)) end:
%p a:= proc(n) option remember; `if`(n<3, 1,
%p s(n-1)+a(2*(n-2^ilog2(n-2))-3))
%p end:
%p seq(a(n), n=1..36); # _Alois P. Heinz_, Sep 24 2019
%t s[n_] := s[n] = If[n < 1, 0, a[n] + s[n-1]];
%t a[n_] := a[n] = If[n < 3, 1, s[n-1] + a[2(n - 2^Floor@Log[2, n-2]) - 3]];
%t Array[a, 36] (* _Jean-François Alcover_, Apr 23 2020, after _Alois P. Heinz_ *)
%Y Cf. A006257, A049939, A049960, A049964.
%K nonn
%O 1,3
%A _Clark Kimberling_
%E Name edited by and more terms from _Petros Hadjicostas_, Sep 24 2019