OFFSET
1,1
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..690
Index entries for linear recurrences with constant coefficients, signature (39,-351,729).
FORMULA
a(n) = 3^(3*n) + 2*3^(2*n) - 3^(n+1) = (3^(n-1) + 1)*(3^n-1)*3^(n+1).
From G. C. Greubel, Oct 04 2019: (Start)
G.f.: 36*x*(1-15*x)/((1-3*x)*(1-9*x)*(1-27*x)).
E.g.f.: exp(27*x) + 2*exp(9*x) - 3*exp(3*x). (End)
MAPLE
A122038:=n->1*3^(3*n)+2*3^(2*n)-3*3^(1*n): seq(A122038(n), n=1..20); # Wesley Ivan Hurt, Apr 23 2017
MATHEMATICA
LinearRecurrence[{39, -351, 729}, {36, 864, 21060}, 20] (* G. C. Greubel, Oct 04 2019 *)
CoefficientList[Series[36x (1-15x)/((1-3x)(1-9x)(1-27x)), {x, 0, 20}], x] (* Harvey P. Dale, Aug 16 2021 *)
PROG
(PARI) for(n=1, 20, print1(3^(3*n)+2*3^(2*n)-3^(n+1), ", "))
(Magma) I:=[36, 864, 21060]; [n le 3 select I[n] else 39*Self(n-1) - 351*Self(n-2) +729*Self(n-3): n in [1..20]]; // G. C. Greubel, Oct 04 2019
(Sage)
def A122038_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return P( 36*x*(1-15*x)/((1-3*x)*(1-9*x)*(1-27*x)) ).list()
a=A122038_list(20); a[1:] # G. C. Greubel, Oct 04 2019
(GAP) a:=[36, 864, 21060];; for n in [4..20] do a[n]:=39*a[n-1] -351*a[n-2] +729a[n-3]; od; a; # G. C. Greubel, Oct 04 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Herman Jamke (hermanjamke(AT)fastmail.fm), Sep 14 2006
STATUS
approved