OFFSET
0,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,-3,2,-1).
FORMULA
a(n) = cos(Pi*n/3) + sin(Pi*n/3)*(2n/3 + 1)*sqrt(3).
MATHEMATICA
LinearRecurrence[{2, -3, 2, -1}, {1, 3, 3, -1}, 70] (* G. C. Greubel, Jul 18 2019 *)
(-1)^Quotient[#-1, 3]{1, 1+#, #}[[Mod[#, 3, 1]]]&/@Range[0, 10] (* Federico Provvedi, Jul 18 2021 *)
PROG
(PARI) my(x='x+O('x^70)); Vec((1+x)/(1-x+x^2)^2) \\ G. C. Greubel, Jul 18 2019
(Magma) R<x>:=PowerSeriesRing(Integers(), 70); Coefficients(R!( (1+x)/(1-x+x^2)^2 )); // G. C. Greubel, Jul 18 2019
(Sage) ((1+x)/(1-x+x^2)^2).series(x, 70).coefficients(x, sparse=False) # G. C. Greubel, Jul 18 2019
(GAP) a:=[1, 3, 3, -1];; for n in [5..70] do a[n]:=2*a[n-1]-3*a[n-2]+ 2*a[n-3] -a[n-4]; od; a; # G. C. Greubel, Jul 18 2019
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Paul Barry, Sep 07 2009
STATUS
approved