login
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

%I #17 Jul 31 2015 21:16:12

%S 1,5,6,22,23,59,60,124,125,225,226,370,371,567,568,824,825,1149,1150,

%T 1550,1551,2035,2036,2612,2613,3289,3290,4074,4075,4975,4976,6000,

%U 6001,7157,7158,8454,8455,9899,9900,11500,11501,13265,13266,15202,15203

%N a(1)=1, a(n)=a(n-1)+n^0 if n odd, a(n)=a(n-1)+ n^2 if n is even.

%H Harvey P. Dale, <a href="/A135301/b135301.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (1, 3, -3, -3, 3, 1, -1).

%F 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

%F 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

%F a(n) = ( (2*n+1)*(n^2+n+3)+3*(n^2+n-1)*(-1)^n )/12. - _Luce ETIENNE_, Jul 26 2014

%t 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*)

%t 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 *)

%Y Cf. A000027, A000217, A000330, A000537, A000538, A000539, A136047, A140113.

%K nonn,easy

%O 1,2

%A _Artur Jasinski_, May 12 2008