OFFSET
0,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-4).
FORMULA
G.f.: (2 + x - 3*x^2 - 2*x^3) / (1 - 3*x^2 + 4*x^4).
a(n) = A247487(n) * 3^( n == 1 (mod 4) ) for all n in Z.
0 = a(n)*(+2*a(n+2)) + a(n+1)*(+2*a(n+1) - 8*a(n+2) + a(n+3)) + a(n+2)*(+a(n+2)) for all n in Z.
a(n) = (-1)^floor(n/2)*H(n, n mod 2, 1/2) for n >= 3 where H(n, a, b) = hypergeom([a - n/2, b - n/2], [1 - n], 8). - Peter Luschny, Sep 03 2019
EXAMPLE
G.f. = 2 + x + 3*x^2 + x^3 + x^4 - x^5 - 9*x^6 - 7*x^7 - 31*x^8 - 17*x^9 + ...
MAPLE
H := (n, a, b) -> hypergeom([a - n/2, b - n/2], [1 - n], 8):
a := n -> `if`(n < 3, [2, 1, 3][n+1], (-1)^iquo(n, 2)*H(n, irem(n, 2), 1/2)):
seq(simplify(a(n)), n=0..42); # Peter Luschny, Sep 03 2019
# second Maple program:
a:= n-> (<<0|1>, <-4|3>>^iquo(n, 2, 'r').<[<2, 3>, <1, 1>][1+r]>)[1, 1]:
seq(a(n), n=0..42); # Alois P. Heinz, Sep 03 2019
MATHEMATICA
CoefficientList[Series[(2+x-3*x^2-2*x^3)/(1-3*x^2+4*x^4), {x, 0, 60}], x] (* G. C. Greubel, Aug 04 2018 *)
PROG
(PARI) {a(n) = if( n<0, n=-n; 2^-n, 1) * polcoeff( (2 + x - 3*x^2 - 2*x^3) / (1 - 3*x^2 + 4*x^4) + x * O(x^n), n)};
(Haskell)
a247564 n = a247564_list !! n
a247564_list = [2, 1, 3, 1] ++ zipWith (-) (map (* 3) $ drop 2 a247564_list)
(map (* 4) $ a247564_list)
-- Reinhard Zumkeller, Sep 20 2014
(Magma) m:=25; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!((2+x-3*x^2-2*x^3)/(1-3*x^2+4*x^4))); // G. C. Greubel, Aug 04 2018
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Michael Somos, Sep 20 2014
STATUS
approved