OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
a(2n) = n*(2n+1), a(2n-1) = (2n-1)*(n-1)+(2n-1)^2. - Stefan Steinerberger, Jan 24 2006
From Bruno Berselli, Mar 19 2012: (Start)
G.f.: x*(1+3x+9x^2+x^3+2x^4)/(1-x^2)^3.
a(n) = n^2-(-1)^n*(n-1)*n/2. (End)
Sum_{n>=1} 1/a(n) = 2 + Pi/(2*sqrt(3)) + log(3*sqrt(3)/16). - Amiram Eldar, Sep 11 2022
EXAMPLE
a(3) = 3+4+5 = 12.
a(6) = 6+5+4+3+2+1 = 21.
MATHEMATICA
For[n = 1, n < 50, n++, If[EvenQ[n], Print[n*(n + 1)/2], Print[n^2 + n*(n - 1)/2]]] (* Stefan Steinerberger, Jan 24 2006 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Amarnath Murthy, Jul 20 2005
EXTENSIONS
More terms from Stefan Steinerberger, Jan 24 2006
STATUS
approved