OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..5000
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
C(n, 2) + n if n odd, C(n, 2) + n/2 + 1 if n even. - T. D. Noe, Nov 09 2006
a(n) = A204556(n+1) / (n+1). - Reinhard Zumkeller, Jan 18 2012
G.f.: -x*(1+2*x+x^2-x^3+x^4) / ( (1+x)^2*(x-1)^3 ). - R. J. Mathar, Aug 13 2012
a(n) = ((-1)^n*(2 - n) + (2 + n + 2*n^2))/4. - G. C. Greubel, Jun 15 2018
EXAMPLE
E.g., for n=4 [ 1:1 ][ 1:2 ][ 2:2 ][ 2:3 ][ 3:3 ][ 3:1 ][ 1:4 ][ 4:4 ][ 4:2 ].
MATHEMATICA
Rest[CoefficientList[Series[x*(1 + 2*x + x^2 - x^3 + x^4)/((1 + x)^2*(1 - x)^3), {x, 0, 50}], x]] (* or *) Table[((-1)^n*(2-n) + (2+n+2*n^2))/4, {n, 1, 50}] (* G. C. Greubel, Jun 15 2018 *)
PROG
(PARI) for(n=1, 60, print1(((-1)^n*(2 - n) + (2 + n + 2*n^2))/4, ", ")) \\ G. C. Greubel, Jun 15 2018
(PARI) Vec(-x*(1+2*x+x^2-x^3+x^4) / ( (1+x)^2*(x-1)^3 ) + O(x^60)) \\ Felix Fröhlich, Jun 18 2018
(Magma) [((-1)^n*(2 - n) + (2 + n + 2*n^2))/4: n in [1..60]]; // G. C. Greubel, Jun 15 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Corrected by T. D. Noe, Nov 09 2006
More terms from Felix Fröhlich, Jun 18 2018
STATUS
approved