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,4,-4,-6,6,4,-4,-1,1).
FORMULA
From R. J. Mathar, Feb 22 2009: (Start)
G.f.: x*(-1-8*x-5*x^2-32*x^3+5*x^4-8*x^5+x^6)/((1+x)^4*(x-1)^5).
a(n) = a(n-1)+4*a(n-2)-4*a(n-3)-6*a(n-4)+6*a(n-5)+4*a(n-6)-4*a(n-7)-a(n-8)+a(n-9). (End)
MATHEMATICA
a = {}; r = 2; s = 3; 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)^3]}; NestList[nxt, {1, 1}, 40][[;; , 2]] (* or *) LinearRecurrence[{1, 4, -4, -6, 6, 4, -4, -1, 1}, {1, 9, 18, 82, 107, 323, 372, 884, 965}, 40] (* Harvey P. Dale, May 27 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Artur Jasinski, May 12 2008
STATUS
approved