This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A122584 #33 Sep 08 2022 08:45:28 %S A122584 1,1,1,1,2,4,9,19,41,87,186,396,845,1801,3841,8189,17462,37232,79389, %T A122584 169275,360937,769603,1640982,3498968,7460649,15907905,33919505, %U A122584 72324585,154213514,328820508,701124865,1494967795,3187632953 %N A122584 Expansion of x*(1+x)*(1-2*x)/(1 - 2*x - x^2 + 2*x^3 - x^4). %D A122584 A. Messiah, Quantum mechanics, vol. 2, pp. 608-609, eq.(XIV.57), North Holland, 1969. %H A122584 Muniru A Asiru, <a href="/A122584/b122584.txt">Table of n, a(n) for n = 1..3000</a> %H A122584 Miklos Bona and Rebecca Smith, <a href="https://arxiv.org/abs/1901.00026">Pattern avoidance in permutations and their squares</a>, arXiv:1901.00026 [math.CO], 2018. See p. 6. %H A122584 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,1,-2,1). %F A122584 G.f.: x*(1+x)*(1-2*x)/(1 - 2*x - x^2 + 2*x^3 - x^4). %F A122584 a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3) + a(n-4). %p A122584 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 %t A122584 a[n_]:= a[n]= If[n<4, 1, 2*a[n-1] +a[n-2] -2*a[n-3] +a[n-4]]; %t A122584 Table[a[n], {n, 50}] (* modified by _G. C. Greubel_, Nov 28 2021 *) %o A122584 (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 %o A122584 (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 %o A122584 (Sage) %o A122584 @CachedFunction # a=A122584 %o A122584 def a(n): return 1 if (n<5) else 2*a(n-1) +a(n-2) -2*a(n-3) +a(n-4) %o A122584 [a(n) for n in (1..50)] # _G. C. Greubel_, Nov 28 2021 %Y A122584 Cf. A122581, A122582, A122583. %K A122584 nonn,easy %O A122584 1,5 %A A122584 _Roger L. Bagula_, Sep 19 2006