OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (2,2,-6,0,6,-2,-2,1).
FORMULA
Theorem: a(n) = (1/8)*n^2*(n+1)^2 - (2/3)*floor((n+1)/2)^3 + (1/6)*floor((n+1)/2).
From Chai Wah Wu, Apr 24 2017: (Start)
a(n) = 2*a(n-1) + 2*a(n-2) - 6*a(n-3) + 6*a(n-5) - 2*a(n-6) - 2*a(n-7) + a(n-8) for n > 8.
G.f.: x^2*(x^4 + 3*x^3 + 11*x^2 + 5*x + 4)/((1 - x)^5*(1 + x)^3). (End)
a(n) = n*(n+1)*(3*n^2+n-1+3*(-1)^n)/24. - Robert Israel, Apr 26 2017
EXAMPLE
For n = 4, a(4) = 1^2*floor(1/2) + 2^2*floor(2/2) + 3^2*floor(3/2) + 4^2*floor(4/2) = 0 + 4 + 9 + 32 = 45.
MAPLE
seq( n*(n+1)*(3*n^2+n-1+3*(-1)^n)/24, n=1..100); # Robert Israel, Apr 26 2017
PROG
(MATLAB) s = @(n) sum((1:n).^2.*floor((1:n)/2)); %summation handle function
s_cf = @(n) 1/8*n^2*(n+1)^2 - 2/3*floor((n+1)/2)^3 + 1/6*floor((n+1)/2); %faster closed-form handle function
(PARI) a(n) = sum(k=1, n, k^2*(k\2)); \\ Michel Marcus, Apr 24 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Néstor Jofré, Apr 24 2017
STATUS
approved