OFFSET
0,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
R. Kemp, On the number of words in the language {w in Sigma* | w = w^R }^2, Discrete Math., 40 (1982), 225-234. See Lemma 1.
Index entries for linear recurrences with constant coefficients, signature (0,6,0,-9).
FORMULA
From Colin Barker, Jul 24 2013: (Start)
a(n) = 6*a(n-2) - 9*a(n-4).
G.f.: 3*x*(x+1)*(3*x+1) / (3*x^2-1)^2. (End)
a(2*n) = 4*n*3^n, a(2*n+1) = (2*n+1)*3^(n+1). - Andrew Howroyd, Mar 28 2016
MAPLE
See A187272.
MATHEMATICA
LinearRecurrence[{0, 6, 0, -9}, {0, 3, 12, 27}, 40] (* Harvey P. Dale, Apr 21 2014 *)
CoefficientList[Series[3 x (x + 1) (3 x + 1)/(3 x^2 - 1)^2, {x, 0, 40}], x] (* Vincenzo Librandi, Apr 23 2014 *)
PROG
(PARI) for(n=0, 50, print1(round((n/4)*3^(n/2)*((1+sqrt(3))^2+(-1)^n*(1-sqrt(3))^2)), ", ")) \\ G. C. Greubel, Jul 08 2018
(Magma) [Round((n/4)*3^(n/2)*((1+Sqrt(3))^2+(-1)^n*(1-Sqrt(3))^2)): n in [0..50]]; // G. C. Greubel, Jul 08 2018
(Python)
def A187273(n): return n*3**(1+(n>>1)) if n&1 else (n<<1)*3**(n>>1) # Chai Wah Wu, Feb 19 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Mar 07 2011
STATUS
approved