OFFSET
1,2
COMMENTS
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1).
FORMULA
a(n) = (1/12)(1 + n)(2n^2+7n-3) if n is odd, a(n)=(1/12)n(2n^2+3n+4) if n is even.
a(n) = (-3 + 3*(-1)^n + 8*n + 12*n^2 - 6*(-1)^n*n^2 + 4*n^3)/24.
a(1)=1 then a(n) = a(n-1)+n^(if n is even then 1 else 2),
or a(n) = a(n-1)+n^(1+mod(n,2)),
or a(n) = a(n-1)+n^((3-(-1)^n)/2).
From R. J. Mathar, Feb 22 2009: (Start)
a(n) = a(n-1)+3*a(n-2)-3*a(n-3)-3*a(n-4)+3*a(n-5)+a(n-6)-a(n-7).
G.f.: x*(1+2*x+6*x^2-2*x^3+x^4)/((1+x)^3*(x-1)^4). (End)
MATHEMATICA
a[1]=1; a[n_]:=a[n]=a[n-1]+n^(1+Mod[n, 2]); Table[a[n], {n, 100}]
nxt[{n_, a_}]:={n+1, If[OddQ[n], a+n+1, a+(n+1)^2]}; Transpose[NestList[nxt, {1, 1}, 50]][[2]] (* Harvey P. Dale, Oct 11 2015 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Zak Seidov, Dec 12 2007
EXTENSIONS
Edited by Michel Marcus, Mar 02 2022
STATUS
approved