login
a(n) = Sum_{k=1..n} (k^2*floor(k/2)).
1

%I #50 Apr 24 2018 05:51:09

%S 0,4,13,45,95,203,350,606,930,1430,2035,2899,3913,5285,6860,8908,

%T 11220,14136,17385,21385,25795,31119,36938,43850,51350,60138,69615,

%U 80591,92365,105865,120280,136664,154088,173740,194565,217893,242535,269971

%N a(n) = Sum_{k=1..n} (k^2*floor(k/2)).

%H Robert Israel, <a href="/A285188/b285188.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (2,2,-6,0,6,-2,-2,1).

%F Theorem: a(n) = (1/8)*n^2*(n+1)^2 - (2/3)*floor((n+1)/2)^3 + (1/6)*floor((n+1)/2).

%F From _Chai Wah Wu_, Apr 24 2017: (Start)

%F 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.

%F G.f.: x^2*(x^4 + 3*x^3 + 11*x^2 + 5*x + 4)/((1 - x)^5*(1 + x)^3). (End)

%F a(n) = n*(n+1)*(3*n^2+n-1+3*(-1)^n)/24. - _Robert Israel_, Apr 26 2017

%e 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.

%p seq( n*(n+1)*(3*n^2+n-1+3*(-1)^n)/24, n=1..100); # _Robert Israel_, Apr 26 2017

%o (MATLAB) s = @(n) sum((1:n).^2.*floor((1:n)/2)); %summation handle function

%o 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

%o (PARI) a(n) = sum(k=1, n, k^2*(k\2)); \\ _Michel Marcus_, Apr 24 2017

%Y Cf. A049779.

%Y Partial sums of A265645.

%K nonn,easy

%O 1,2

%A _Néstor Jofré_, Apr 24 2017