login
A247564
a(n) = 3*a(n-2) - 4*a(n-4) with a(0) = 2, a(1) = 1, a(2) = 3, a(3) = 1.
3
2, 1, 3, 1, 1, -1, -9, -7, -31, -17, -57, -23, -47, -1, 87, 89, 449, 271, 999, 457, 1201, 287, -393, -967, -5983, -4049, -16377, -8279, -25199, -8641, -10089, 7193, 70529, 56143, 251943, 139657, 473713, 194399, 413367, 24569, -654751, -703889, -3617721
OFFSET
0,1
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.
a(2*n) = A247563(n). a(2*n + 1) = A247560(n).
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