OFFSET
0,2
COMMENTS
Partial sums are A086955.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..2000
Index entries for linear recurrences with constant coefficients, signature (1,1,-1).
FORMULA
G.f.: (1+4*x-3*x^2+2*x^3)/((1+x)*(1-x)^2).
a(n) = n + abs(2 - (n + 1)*(-1)^n). - Lechoslaw Ratajczak, Dec 09 2016
From Guenther Schrack, Jun 09 2017: (Start)
a(n) = 2*n + 1 - 2*(-1)^n for n > 0.
a(n) = 2*n + 1 - 2*cos(n*Pi) for n > 0.
a(n) = 4*n - a(n-1) for n > 1.
Linear recurrence: a(n) = a(n-1) + a(n-2) - a(n-3) for n > 3.
First differences: 2 - 4*(-1)^n for n > 1; -(-1)^n*A010696(n) for n > 1.
a(n) = A065164(n+1) + n for n > 0.
a(2*n-1) = A004766(n) for n > 0.
a(2*n+2) = A004767(n) for n >= 0. (End)
MATHEMATICA
Join[{1}, LinearRecurrence[{1, 1, -1}, {5, 3, 9}, 60]] (* Vincenzo Librandi, Jun 21 2017 *)
PROG
(Magma) [1] cat [2*n+1-2*(-1)^n: n in [1..70]]; // Vincenzo Librandi, Jun 21 2017
(PARI) Vec((1+4*x-3*x^2+2*x^3)/((1+x)*(1-x)^2) + O(x^100)) \\ Michel Marcus, Jun 21 2017
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Jul 26 2003
STATUS
approved