OFFSET
1,2
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1).
FORMULA
a(n) = Sum_{i=1..floor(n/2)} (i^2 + (n-i)^2).
a(n) = n*(8*n^2 - 9*n + 4)/24 + (-1)^n*n^2/8. - Giovanni Resta, May 29 2013
G.f.: x^2*(2+3*x+7*x^2+3*x^3+x^4) / ( (1+x)^3*(x-1)^4 ). - R. J. Mathar, Jun 07 2013
a(n) = a(n-1) + 3*a(n-2) - 3*a(n-3) - 3*a(n-4) + 3*a(n-5) + a(n-6) - a(n-7). - Wesley Ivan Hurt, Jun 22 2024
EXAMPLE
a(5) = 30; 5 has exactly 2 partitions into two parts, (4,1) and (3,2). Squaring the parts and adding, we get: 1^2 + 2^2 + 3^2 + 4^2 = 30.
MAPLE
a:=n->sum(i^2 + (n-i)^2, i=1..floor(n/2)); seq((a(k), k=1..40);
MATHEMATICA
Array[Sum[i^2 + (# - i)^2, {i, Floor[#/2]}] &, 39] (* Michael De Vlieger, Jan 23 2018 *)
LinearRecurrence[{1, 3, -3, -3, 3, 1, -1}, {0, 2, 5, 18, 30, 64, 91}, 50] (* Harvey P. Dale, Jul 23 2019 *)
PROG
(Magma) [n*(8*n^2 - 9*n + 4)/24 + (-1)^n*n^2/8 : n in [1..80]]; // Wesley Ivan Hurt, Jun 22 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, May 27 2013
STATUS
approved