OFFSET
0,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (5,-7,3).
FORMULA
From Vincenzo Librandi, Mar 06 2013: (Start)
G.f.: (1-3*x+4*x^2)/((1-3*x)*(1-x)^2).
a(n) = 5*a(n-1) - 7*a(n-2) + 3*a(n-3). (End)
E.g.f.: exp(x)*(exp(2*x) - x). - Elmo R. Oliveira, Sep 06 2024
MATHEMATICA
Table[3^n - n, {n, 0, 40}] (* or *) CoefficientList[Series[(1 - 3 x + 4 x^2)/((1 - 3 x)(1 - x)^2), {x, 0, 30}], x] (* Vincenzo Librandi, Mar 06 2013 *)
PROG
(Magma) [3^n - n: n in [0..35]]; // Vincenzo Librandi, May 13 2011
(Magma) I:=[1, 2, 7]; [n le 3 select I[n] else 5*Self(n-1)-7*Self(n-2)+3*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Mar 06 2013
(PARI) a(n)=3^n-n \\ Charles R Greathouse IV, Sep 24 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved