login
A135301
a(1)=1, a(n)=a(n-1)+n^0 if n odd, a(n)=a(n-1)+ n^2 if n is even.
2
1, 5, 6, 22, 23, 59, 60, 124, 125, 225, 226, 370, 371, 567, 568, 824, 825, 1149, 1150, 1550, 1551, 2035, 2036, 2612, 2613, 3289, 3290, 4074, 4075, 4975, 4976, 6000, 6001, 7157, 7158, 8454, 8455, 9899, 9900, 11500, 11501, 13265, 13266, 15202, 15203
OFFSET
1,2
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 *)
KEYWORD
nonn,easy
AUTHOR
Artur Jasinski, May 12 2008
STATUS
approved