OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (1, 5, -5, -10, 10, 10, -10, -5, 5, 1, -1).
FORMULA
G.f.: x*(1+16*x+4*x^2+176*x^3-10*x^4+176*x^5+4*x^6+16*x^7+x^8)/((1+x)^5*(x-1)^6). - R. J. Mathar, Feb 22 2009
a(n) = (6*n^5 + 15*n^4 + 20*n^3 + 15*n^2 + 4*n + (15*n^4 + 30*n^3 - 15*n^2 - 30*n)*(-1)^n)/60. - Charles R Greathouse IV, Jun 03 2026
MATHEMATICA
a = {}; r = 2; s = 4; 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+(n+1)^4]}; NestList[nxt, {1, 1}, 40][[All, 2]] (* or *) LinearRecurrence[{1, 5, -5, -10, 10, 10, -10, -5, 5, 1, -1}, {1, 17, 26, 282, 307, 1603, 1652, 5748, 5829, 15829, 15950}, 40] (* Harvey P. Dale, Aug 28 2017 *)
PROG
(PARI) a(n)=my(q=n\2); 16*q^5/5+8*q^4+20*q^3/3+[-13*q, 60*q^2+47*q+15][n%2+1]/15 \\ Charles R Greathouse IV, Jun 03 2026
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Artur Jasinski, May 12 2008
STATUS
approved
