OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1, 3, -3, -3, 3, 1, -1).
FORMULA
O.g.f.: x*(x^4+4*x^3-2*x^2+4*x+1)/((-1+x)^4*(1+x)^3) . a(2n-1) = 4*n^3/3-2*n^2+5*n/3, a(2n) = 4*n^3/3+2*n^2+5*n/3. - R. J. Mathar, May 17 2008
a(1)=1, a(2)=5, a(3)=6, a(4)=22, a(5)=23, a(6)=59, a(7)=60, 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). - Harvey P. Dale, Jul 16 2014
a(n) = ( (2*n+1)*(n^2+n+3)+3*(n^2+n-1)*(-1)^n )/12. - Luce ETIENNE, Jul 26 2014
MATHEMATICA
a = {}; r = 0; s = 2; Do[k = 0; Do[k = k + (Sin[Pi m/2]^2) m^r + (Cos[Pi m/2]^2) m^s, {m, 1, n}]; AppendTo[a, k], {n, 1, 100}]; a (*Artur Jasinski*)
nxt[{n_, a_}]:={n+1, If[EvenQ[n], a+1, a+(n+1)^2]}; Transpose[NestList[nxt, {1, 1}, 50]][[2]] (* or *) LinearRecurrence[{1, 3, -3, -3, 3, 1, -1}, {1, 5, 6, 22, 23, 59, 60}, 50] (* Harvey P. Dale, Jul 16 2014 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Artur Jasinski, May 12 2008
STATUS
approved