OFFSET
1,2
COMMENTS
Characteristic polynomial is x^4 - 4*x^3 - 42*x^2 - 36*x + 81.
a(n)/a(n-1) tends to 9.
Square root of M = the 4 X 4 matrix: [1/u, 1, u, 1; 1, 1/u, 1, u; u, 1, 1/u, 1; 1, u, 1, 1/u]; where u, 1/u and 1 are the cyclotomic third roots of Unity: (-1, + sqrt(3)i)/2, (-1, -sqrt(3)i)/2 and 1.
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (7,21,-27).
FORMULA
a(n) = leftmost term in M^n * [1,0,0,0] where M is the 4 X 4 matrix: [1,-2,4,-2; -2,1,-2,4; 4,-2,1,-2; -2,4,-2,1].
From R. J. Mathar, Sep 09 2008: (Start)
G.f.: x*(1+18*x-27*x^2) / ((1-x)*(1-9*x)*(1+3*x)).
a(n) = 7*a(n-1) + 21*a(n-2) - 27*a(n-3).
(End)
a(n) = (1 + 2*(-3)^n + 9^n) / 4. - Colin Barker, Dec 23 2017
EXAMPLE
a(4) = 1681 = 41^2 = the square of A046717(4).
a(4) = 1681 since M^4 * [1,0,0,0] = [1681, -1640, 1600, -1640].
MATHEMATICA
Rest@ Nest[Append[#, 2 #[[-1]] + 3 #[[-2]]] &, {1, 1}, 20]^2 (* or *)
Rest@ CoefficientList[Series[x (1 +18x -27x^2)/((1-x)(1-9x)(1+3x)), {x, 0, 21}], x] (* or *)
LinearRecurrence[{7, 21, -27}, {1, 25, 169}, 21] (* Michael De Vlieger, Dec 22 2017 *)
((1+(-3)^Range[40])/2)^2 (* G. C. Greubel, May 03 2023 *)
PROG
(PARI) Vec(x*(1+18*x-27*x^2) / ((1-x)*(1-9*x)*(1+3*x)) + O(x^40)) \\ Colin Barker, Dec 23 2017
(Magma) [(1 + (-3)^n)^2/4: n in [1..40]]; // G. C. Greubel, May 03 2023
(SageMath) [int((1+(-3)^n)/2)^2 for n in range(1, 41)] # G. C. Greubel, May 03 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Gary W. Adamson, Jun 08 2006
EXTENSIONS
More terms from Michael De Vlieger, Dec 22 2017
STATUS
approved