OFFSET
1,2
COMMENTS
This sequence is generated by listing the successive results of 1 + 2 + 3 - 4 + 5 + 6 - 7 + 8 + 9 - 10 + ... etc.
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.
LINKS
Seiichi Manyama, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (1,0,2,-2,0,-1,1).
FORMULA
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.
G.f.: (-2*z^6 - z^4 + 6*z^3 - 3*z^2 - 2*z - 1)/((z - 1)^3*(z^2 + z + 1)^2).
a(3*n-2) = A143689(n-1).
From Franck Maminirina Ramaharo, Dec 27 2018: (Start)
a(n) = a(n-1) + 2*a(n-3) - 2*a(n-4) - a(n-6) + a(n-7), n >= 8.
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)
EXAMPLE
n1 = 0 + 1 = 1
n2 = 1 + 2 = 3
n3 = 1 + 2 + 3 = 6
n4 = 1 + 2 + 3 - 4 = 2
n5 = 1 + 2 + 3 - 4 + 5 = 7
n6 = 1 + 2 + 3 - 4 + 5 + 6 = 13
n7 = 1 + 2 + 3 - 4 + 5 + 6 - 7 = 6
...
->
(n3, n5, n7) = (6, 7, 6)
(n6, n8, n10) = (13, 14, 13)
...
->
n9 = 2.n6 - n7 + 3 = 23
MATHEMATICA
Accumulate@ Table[If[Mod[n, 3] == 1 && n > 1, -n, n], {n, 50}] (* Michael De Vlieger, May 23 2016 *)
LinearRecurrence[{1, 0, 2, -2, 0, -1, 1}, {1, 3, 6, 2, 7, 13, 6}, 80] (* Harvey P. Dale, Oct 13 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Mattias Dooreman, May 23 2016
EXTENSIONS
a(25) corrected by Seiichi Manyama, May 26 2016
STATUS
approved