A140148 a(1)=1, a(n)=a(n-1)+n^2 if n odd, a(n)=a(n-1)+ n^0 if n is even.
1, 2, 11, 12, 37, 38, 87, 88, 169, 170, 291, 292, 461, 462, 687, 688, 977, 978, 1339, 1340, 1781, 1782, 2311, 2312, 2937, 2938, 3667, 3668, 4509, 4510, 5471, 5472, 6561, 6562, 7787, 7788, 9157, 9158, 10679, 10680, 12361, 12362, 14211, 14212, 16237
Offset: 1
Keywords
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).
Programs
-
Mathematica
a = {}; r = 2; s = 0; 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+(n+1)^2,a+1]}; NestList[nxt,{1,1},50][[All,2]] (* Harvey P. Dale, Sep 05 2021 *)
Formula
a(n)=a(n-1)+3a(n-2)-3a(n-3)-3a(n-4)+3a(n-5)+a(n-6)-a(n-7). G.f.: x*(1+x+6*x^2-2*x^3+x^4+x^5)/((1+x)^3*(x-1)^4). [From R. J. Mathar, Feb 22 2009]