A052938 Expansion of (1 + 2*x - 2*x^2)/( (1+x)*(1-x)^2 ).
1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15, 14, 16, 15, 17, 16, 18, 17, 19, 18, 20, 19, 21, 20, 22, 21, 23, 22, 24, 23, 25, 24, 26, 25, 27, 26, 28, 27, 29, 28, 30, 29, 31, 30, 32, 31, 33, 32, 34, 33, 35, 34, 36, 35, 37, 36, 38, 37, 39
Offset: 0
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 929
- Index entries for linear recurrences with constant coefficients, signature (1,1,-1).
Programs
-
GAP
List([0..30], n-> (2*n+7-3*(-1)^n)/4); # G. C. Greubel, Oct 18 2019
-
Haskell
a052938 n = a052938_list !! n a052938_list = 1 : 3 : 2 : zipWith (-) [5..] a052938_list -- Reinhard Zumkeller, Oct 06 2015
-
Magma
[(2*n+7-3*(-1)^n)/4: n in [0..30]]; // G. C. Greubel, Oct 18 2019
-
Magma
R
:=PowerSeriesRing(Integers(), 75); Coefficients(R!( (1 + 2*x - 2*x^2)/( (1+x)*(1-x)^2 ))); // Marius A. Burtea, Oct 18 2019 -
Maple
spec := [S,{S=Prod(Union(Sequence(Z),Z,Z),Sequence(Prod(Z,Z)))},unlabeled ]: seq(combstruct[count ](spec,size=n), n=0..20); seq((2*n+7-3*(-1)^n)/4, n=0..30); # G. C. Greubel, Oct 18 2019
-
Mathematica
LinearRecurrence[{1,1,-1},{1,3,2},80] (* Harvey P. Dale, Apr 10 2019 *)
-
PARI
a(n)=([0,1,0; 0,0,1; -1,1,1]^n*[1;3;2])[1,1] \\ Charles R Greathouse IV, Sep 02 2015
-
Sage
[(2*n+7-3*(-1)^n)/4 for n in (0..30)] # G. C. Greubel, Oct 18 2019
Formula
G.f.: (1+2*x-2*x^2)/((1+x)*(1-x)^2).
a(n) = -a(n-1) + n + 3, with a(0)=1.
a(n) = (3*(-1)^(n+1) + 2*n + 7)/4.
a(n) = A060762(n+1) - 1. - Filip Zaludek, Nov 19 2016
E.g.f.: ((5+x)*sinh(x) + (2+x)*cosh(x))/2. - G. C. Greubel, Oct 18 2019
Extensions
More terms from James Sellers, Jun 06 2000