This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A049940 #32 Apr 23 2020 10:00:10 %S A049940 1,1,3,6,14,26,54,119,278,503,1008,2027,4094,8412,17554,38194,89848, %T A049940 162143,324288,648587,1297214,2594652,5190034,10383154,20779768, %U A049940 41631830,83498100,167969126,339831072,695251878,1453222088,3162777148,7438945312,13424668537,26849337076,53698674163 %N A049940 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 A049940 Alois P. Heinz, <a href="/A049940/b049940.txt">Table of n, a(n) for n = 1..3320</a> %F A049940 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 A049940 From _Petros Hadjicostas_, Sep 24 2019: (Start) %e A049940 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 A049940 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 A049940 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 A049940 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 A049940 (End) %p A049940 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 A049940 # second Maple program: %p A049940 s:= proc(n) option remember; `if`(n<1, 0, a(n)+s(n-1)) end: %p A049940 a:= proc(n) option remember; `if`(n<3, 1, %p A049940 s(n-1)+a(2*(n-2^ilog2(n-2))-3)) %p A049940 end: %p A049940 seq(a(n), n=1..36); # _Alois P. Heinz_, Sep 24 2019 %t A049940 s[n_] := s[n] = If[n < 1, 0, a[n] + s[n-1]]; %t A049940 a[n_] := a[n] = If[n < 3, 1, s[n-1] + a[2(n - 2^Floor@Log[2, n-2]) - 3]]; %t A049940 Array[a, 36] (* _Jean-François Alcover_, Apr 23 2020, after _Alois P. Heinz_ *) %Y A049940 Cf. A006257, A049939, A049960, A049964. %K A049940 nonn %O A049940 1,3 %A A049940 _Clark Kimberling_ %E A049940 Name edited by and more terms from _Petros Hadjicostas_, Sep 24 2019