OFFSET
1,2
COMMENTS
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,-1).
FORMULA
G.f.: x^2*(4 - 3*x)/((1+x)*(1-x)^2).
a(n) = (7*(-1)^n + 2*n + 5)/4.
a(n) = a(n-2) + 1 for n>2; a(1)=0, a(2)=4.
a(n+1) - a(n) = A168309(n).
a(n) = a(n-1) + a(n-2) - a(n-3). - Colin Barker, Nov 08 2014
E.g.f.: (1/4)*(7 - 12*exp(x) + (5 + 2*x)*exp(2*x))*exp(-x). - G. C. Greubel, Jul 16 2016
Sum_{n>=2} (-1)^(n+1)/a(n) = 11/6. - Amiram Eldar, Feb 23 2023
EXAMPLE
a(2) = 2+2-a(1) = 4-0 = 4; a(3) = 3+2-a(2) = 5-4 = 1.
MATHEMATICA
a=3; Table[a=n-a, {n, 3, 200}] (* Vladimir Joseph Stephan Orlovsky, Nov 22 2009 *)
CoefficientList[Series[x (4 - 3 x) / ((1 + x) (1 - x)^2), {x, 0, 100}], x] (* Vincenzo Librandi, Sep 16 2013 *)
LinearRecurrence[{1, 1, -1}, {0, 4, 1}, 50] (* G. C. Greubel, Jul 16 2016 *)
nxt[{n_, a_}]:={n+1, n+3-a}; NestList[nxt, {1, 0}, 80][[All, 2]] (* Harvey P. Dale, May 28 2021 *)
PROG
(Magma) [ n eq 1 select 0 else -Self(n-1)+n+2: n in [1..75] ];
(PARI) Vec(x^2*(4-3*x)/((1+x)*(1-x)^2) + O(x^100)) \\ Colin Barker, Nov 08 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vincenzo Librandi, Nov 21 2009
EXTENSIONS
Edited, three comments, four formulas, MAGMA program added by Klaus Brockhaus, Nov 22 2009
STATUS
approved