%I #31 Oct 13 2024 18:18:58
%S 1,3,6,2,7,13,6,14,23,13,24,36,23,37,52,36,53,71,52,72,93,71,94,118,
%T 93,119,146,118,147,177,146,178,211,177,212,248,211,249,288,248,289,
%U 331,288,332,377,331,378,426,377,427
%N Numbers generated by starting at 1 and adding twice and subtracting once following the sequence of positive integers.
%C This sequence is generated by listing the successive results of 1 + 2 + 3 - 4 + 5 + 6 - 7 + 8 + 9 - 10 + ... etc.
%C By adding twice and subtracting once, the results at positions i, i+2 and i+4 are linked by the relationship: n, n+1, n.
%H Seiichi Manyama, <a href="/A273465/b273465.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,2,-2,0,-1,1).
%F Let the sequence be written 1, 3, a, 2, a+1, b, a, b+1, c, b, c+1, d, c, ... The (a, a+1, a) triple at positions i, i+2, i+4 can be determined from the previous two sequences: (c = 2*b - a + 3). This new sequence starts at position i+3.
%F G.f.: (-2*z^6 - z^4 + 6*z^3 - 3*z^2 - 2*z - 1)/((z - 1)^3*(z^2 + z + 1)^2).
%F a(3*n-2) = A143689(n-1).
%F From _Franck Maminirina Ramaharo_, Dec 27 2018: (Start)
%F a(n) = a(n-1) + 2*a(n-3) - 2*a(n-4) - a(n-6) + a(n-7), n >= 8.
%F E.g.f.: (1/18)*(exp(3*x/2)*(32 + 6*x + 3*x^2) + (4 - 12*x)*cos(sqrt(3)*x/2) - 4*sqrt(3)*(1 + x)*sin(sqrt(3)*x/2))/exp(x/2). (End)
%e n1 = 0 + 1 = 1
%e n2 = 1 + 2 = 3
%e n3 = 1 + 2 + 3 = 6
%e n4 = 1 + 2 + 3 - 4 = 2
%e n5 = 1 + 2 + 3 - 4 + 5 = 7
%e n6 = 1 + 2 + 3 - 4 + 5 + 6 = 13
%e n7 = 1 + 2 + 3 - 4 + 5 + 6 - 7 = 6
%e ...
%e ->
%e (n3, n5, n7) = (6, 7, 6)
%e (n6, n8, n10) = (13, 14, 13)
%e ...
%e ->
%e n9 = 2.n6 - n7 + 3 = 23
%t Accumulate@ Table[If[Mod[n, 3] == 1 && n > 1, -n, n], {n, 50}] (* _Michael De Vlieger_, May 23 2016 *)
%t LinearRecurrence[{1,0,2,-2,0,-1,1},{1,3,6,2,7,13,6},80] (* _Harvey P. Dale_, Oct 13 2024 *)
%Y Cf. A143689.
%K nonn
%O 1,2
%A _Mattias Dooreman_, May 23 2016
%E a(25) corrected by _Seiichi Manyama_, May 26 2016