OFFSET
0,2
COMMENTS
The subsequence of primes begins 3, 7, 17, no more through a(27).
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (5,-4,-12,21,-9).
FORMULA
a(n) = Sum_{i=0..n} (if i mod 2 = 0 then ((3^((i-2)/2)+1)/2)^2 else 3^((i-3)/2)+(1/4)*(3^(i-2)+1)).
G.f.: (6*x^3-4*x^2-2*x+1) / ((x-1)^2*(3*x-1)*(3*x^2-1)). - Colin Barker, Apr 20 2013
From Colin Barker, May 17 2016: (Start)
a(n) = (-7+3^(1+n)+3^(1/2*(-1+n))*(9-9*(-1)^n+5*sqrt(3)+5*(-1)^n*sqrt(3))+2*(1+n))/8.
a(n) = (2*n + 10*3^(n/2) + 3^(n+1) - 5)/8 for n even.
a(n) = (2*n + 3^(n+1) + 2*3^((n+3)/2) - 5)/8 for n odd.
a(n) = 5*a(n-1) - 4*a(n-2) - 12*a(n-3) + 21*a(n-4) - 9*a(n-5) for n>4.
(End)
EXAMPLE
a(5) = 1 + 2 + 4 + 10 + 25 + 70 = 112.
MATHEMATICA
CoefficientList[Series[(6*x^3-4*x^2-2*x+1)/((x-1)^2*(3*x-1)*(3*x^2-1)), {x, 0, 30}], x] (* G. C. Greubel, Jan 24 2019 *)
PROG
(PARI) Vec((1-2*x-4*x^2+6*x^3)/((1-x)^2*(1-3*x)*(1-3*x^2)) + O(x^50)) \\ Colin Barker, May 17 2016
(Magma) m:=30; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!( (6*x^3-4*x^2-2*x+1)/((x-1)^2*(3*x-1)*(3*x^2-1)) )); // G. C. Greubel, Jan 24 2019
(Sage) ((6*x^3-4*x^2-2*x+1)/((x-1)^2*(3*x-1)*(3*x^2-1))).series(x, 30).coefficients(x, sparse=False) # G. C. Greubel, Jan 24 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jonathan Vos Post, Dec 26 2010
STATUS
approved