%I #27 Jan 02 2023 12:30:54
%S 1,2,-1,1,4,-3,1,6,-5,1,8,-7,1,10,-9,1,12,-11,1,14,-13,1,16,-15,1,18,
%T -17,1,20,-19,1,22,-21,1,24,-23,1,26,-25,1,28,-27,1,30,-29,1,32,-31,1,
%U 34,-33,1,36,-35,1,38,-37,1,40,-39
%N a(1) = 1, then a(n+1) = a(n) - (-1)^a(n) Sum_{k=1..n} a(k): if a(n) is odd, add the partial sum, else subtract.
%C The terms display a 3-quasiperiodic pattern (1, 2m, 1-2m), m = 1, 2, 3, ...
%H Eric Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2020-February/020509.html">Re: Add or subtract my cumulative sum of terms</a>, SeqFan list, Feb 24 2020.
%F a(3k-2) = 1, a(3k-1) = 2k, a(3k) = 1 - 2k, for all k >= 1.
%F Conjectures from _Colin Barker_, Feb 25 2020: (Start)
%F G.f.: x*(1 + x)*(1 + 2*x + x^3) / ((1 - x)*(1 + x + x^2)^2).
%F a(n) = -a(n-1) - a(n-2) + a(n-3) + a(n-4) + a(n-5) for n>5.
%F (End)
%e a(1) = 1 is odd, so we add the partial sum (so far equal to a(1)) to get the next term, a(2) = 2.
%e Now a(2) = 2 is even, so we subtract the partial sum 1 + 2 = 3 to get a(3) = -1.
%e And so on.
%o (PARI) s=-a=1; vector(100,n, a-=(-1)^a*s+=a)
%o (PARI) apply( {A332056(n)=[1-n\3*2,1,n\/3*2][n%3+1]}, [1..99])
%Y See A332057 for the partial sums.
%K sign
%O 1,2
%A _Eric Angelini_ and _M. F. Hasler_, Feb 24 2020
|