login
A024024
a(n) = 3^n - n.
14
1, 2, 7, 24, 77, 238, 723, 2180, 6553, 19674, 59039, 177136, 531429, 1594310, 4782955, 14348892, 43046705, 129140146, 387420471, 1162261448, 3486784381, 10460353182, 31381059587, 94143178804, 282429536457, 847288609418, 2541865828303, 7625597484960, 22876792454933
OFFSET
0,2
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
Sequence in context: A375273 A272483 A129020 * A027122 A132788 A109682
KEYWORD
nonn,easy
STATUS
approved