OFFSET
0,3
COMMENTS
a(1) = 1, a(2) = 2+4=6, a(3) = 5+3+9=17, a(4) = 10+6+8+16=40.
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
FORMULA
a(n) = a(n-1) + n^2 + (n - 1)^2 - floor((n-1)/2)*floor((n+1)/2).
If n is odd then a(n) = (7*n^3 + 5*n)/12;
If n is even then a(n) = (7*n^3 + 8*n)/12.
From Colin Barker, Sep 13 2014: (Start)
a(n) = (n*(13 + 3*(-1)^n + 14*n^2))/24.
a(n) = 2*a(n-1) + a(n-2) - 4*a(n-3) + a(n-4) + 2*a(n-5) - a(n-6).
G.f.: x*(x^4 + 4*x^3 + 4*x^2 + 4*x + 1)/((x - 1)^4*(x + 1)^2). (End)
E.g.f.: x*((12 + 21*x + 7*x^2)*cosh(x) + (15 + 21*x + 7*x^2)*sinh(x))/12. - Stefano Spezia, Jun 05 2023
MATHEMATICA
LinearRecurrence[{2, 1, -4, 1, 2, -1}, {0, 1, 6, 17, 40, 75}, 50] (* Harvey P. Dale, Oct 17 2021 *)
Accumulate[Table[n^2 + (n - 1)^2 - Floor[((n-1)/2)]*Floor[((n+1)/2)], {n, 41}]] (* Stefano Spezia, Jun 05 2023 *)
PROG
(PARI) concat(0, Vec(x*(x^4+4*x^3+4*x^2+4*x+1)/((x-1)^4*(x+1)^2) + O(x^100))) \\ Colin Barker, Sep 13 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Henry Bottomley, Jun 07 2001
STATUS
approved