%I #23 Sep 08 2022 08:45:39
%S 1,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,
%T 3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,
%U 3,1
%N a(n) = n + Sum_{j=1..n-1} (-1)^j * a(j) for n >= 2, a(1) = 1.
%C Row sums of triangle A153860. - _Gary W. Adamson_, Jan 03 2009
%C 1 followed by interleaving of A000012 and A010701. - _Klaus Brockhaus_, Jan 04 2009
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,1).
%F a(n)=1 if n is 1 or even; a(n)=3 if n is odd other than 1.
%F G.f.: x*(1 + x + 2*x^2)/((1+x)*(1-x)). - _Klaus Brockhaus_, Jan 04 2009 and Oct 15 2009
%e a(1)=1, a(2)=2-a(1)=2-1=1, a(3)=3+a(2)-a(1)=3+1-1=3, a(4)=4-a(3)+a(2)-a(1)=4-3+1-1=1, a(5)=5+1-3+1-1=3, a(6)=6-3+1-3+1-1=1, a(7)=7+1-3+1-3+1-1, etc.
%o (Magma) S:=[ 1 ]; for n in [2..105] do Append(~S, n + &+[ (-1)^j*S[j]: j in [1..n-1] ]); end for; S; // _Klaus Brockhaus_, Jan 04 2009
%Y Equals A010684 with the addition of the leading term of 1
%Y The first sequence of a family that includes A153285 and A153286
%Y Cf. A153860.
%Y Cf. A000012 (all 1's sequence), A010701 (all 3's sequence). - _Klaus Brockhaus_, Jan 04 2009
%K easy,nonn
%O 1,3
%A _Walter Carlini_, Dec 23 2008