%I #35 Feb 03 2023 01:34:09
%S 1,3,2,5,9,19,37,67,106,248,495,983,1938,3807,7225,13007,20727,48678,
%T 97355,194703,389378,778687,1556985,3112527,6219767,12426032,24775436,
%U 49258849,97350091,190037400,361519131,650463607,1036758174
%N a(n) = a(1) + a(2) + ... + a(n-1) - a(m) for n >= 4, 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) = 1, a(2) = 3, and a(3) = 2.
%C The number m in the definition of the sequence equals 2*n - 3 - x, where x is the smallest power of 2 >= n-1. It turns out that m = A006257(n-2), where the sequence b(n) = A006257(n) satisfies b(2*n) = 2*b(n) - 1 and b(2*n + 1) = 2*b(n) + 1, and it is related to the so-called Josephus problem. - _Petros Hadjicostas_, Sep 25 2019
%H Robert Israel, <a href="/A049920/b049920.txt">Table of n, a(n) for n = 1..3323</a>
%H <a href="/index/J#Josephus">Index entries for sequences related to the Josephus Problem</a>
%F a(n) = -a(A006257(n-2)) + Sum_{i = 1..n-1} a(i) for n >= 4 with a(1) = 1, a(2) = 3, and a(3) = 2.
%e From _Petros Hadjicostas_, Sep 25 2019: (Start)
%e a(4) = -a(A006257(4-2)) + a(1) + a(2) + a(3) = -a(1) + a(1) + a(2) + a(3) = 5.
%e a(5) = -a(A006257(5-2)) + a(1) + a(2) + a(3) + a(4) = -a(3) + a(1) + a(2) + a(3) + a(4) = 9.
%e a(6) = -a(A006257(6-2)) + a(1) + a(2) + a(3) + a(4) + a(5) = 19.
%e a(7) = -a(A006257(7-2)) + a(1) + a(2) + a(3) + a(4) + a(5) + a(6) = 37.
%e (End)
%p A[1]:= 1: A[2]:= 3: A[3]:= 2:
%p for n from 4 to 100 do
%p q:= ceil(log[2](n-1));
%p m:= 2*n-3-2^q;
%p A[n]:= add(A[i],i=1..n-1)-A[m];
%p od:
%p seq(A[i],i=1..100); # _Robert Israel_, Feb 27 2017
%Y Cf. A006257, A049939, A049960, A049964, A049979.
%K nonn
%O 1,2
%A _Clark Kimberling_
%E Name edited by _Petros Hadjicostas_, Sep 25 2019