login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A122584
Expansion of x*(1+x)*(1-2*x)/(1 - 2*x - x^2 + 2*x^3 - x^4).
6
1, 1, 1, 1, 2, 4, 9, 19, 41, 87, 186, 396, 845, 1801, 3841, 8189, 17462, 37232, 79389, 169275, 360937, 769603, 1640982, 3498968, 7460649, 15907905, 33919505, 72324585, 154213514, 328820508, 701124865, 1494967795, 3187632953
OFFSET
1,5
REFERENCES
A. Messiah, Quantum mechanics, vol. 2, pp. 608-609, eq.(XIV.57), North Holland, 1969.
LINKS
Miklos Bona and Rebecca Smith, Pattern avoidance in permutations and their squares, arXiv:1901.00026 [math.CO], 2018. See p. 6.
FORMULA
G.f.: x*(1+x)*(1-2*x)/(1 - 2*x - x^2 + 2*x^3 - x^4).
a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3) + a(n-4).
MAPLE
seq(coeff(series((x*(1+x)*(2*x-1))/(x^4-2*x^3+x^2+2*x-1), x, n+1), x, n), n = 1 .. 40); # Muniru A Asiru, Jan 03 2019
MATHEMATICA
a[n_]:= a[n]= If[n<4, 1, 2*a[n-1] +a[n-2] -2*a[n-3] +a[n-4]];
Table[a[n], {n, 50}] (* modified by G. C. Greubel, Nov 28 2021 *)
PROG
(PARI) Vec(x*(1+x)*(2*x-1)/(-1+2*x+x^2-2*x^3+x^4)+O(x^99)) \\ Charles R Greathouse IV, Sep 27 2012
(Magma) [n le 5 select 1 else 2*Self(n-1) +Self(n-2) -2*Self(n-3) +Self(n-4): n in [1..50]]; // G. C. Greubel, Nov 28 2021
(Sage)
@CachedFunction # a=A122584
def a(n): return 1 if (n<5) else 2*a(n-1) +a(n-2) -2*a(n-3) +a(n-4)
[a(n) for n in (1..50)] # G. C. Greubel, Nov 28 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Roger L. Bagula, Sep 19 2006
STATUS
approved