OFFSET
0,4
COMMENTS
For even n, the sequence gives the sum of the smallest parts of the partitions of n into two parts. For odd n, the sequence gives the sum of the largest parts of the partitions of n into two parts (see example).
Union of triangular numbers (A000217) and second pentagonal numbers (A005449). - Wesley Ivan Hurt, Oct 31 2015
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
a(n) = floor(n/2) * (3*floor(n/2)+1) * (n mod 2)/2 + floor(n/2) * (floor(n/2)+1) * ((n+1) mod 2)/2.
From Colin Barker, Jul 23 2014: (Start)
a(n) = 3*a(n-2) - 3*a(n-4) + a(n-6) for n>5.
G.f.: -x^2*(x^3+2*x+1) / ((x-1)^3*(x+1)^3). (End)
Sum_{n>=2} 1/a(n) = 8 - Pi/sqrt(3) - 3*log(3). - Amiram Eldar, Aug 25 2022
EXAMPLE
a(6) = 6; the partitions of 6 into two parts are: (5,1), (4,2), (3,3). Since 6 is even, we add the smallest parts in these partitions to get 6.
a(7) = 15; the partitions of 7 into two parts are: (6,1), (5,2), (4,3). Since 7 is odd, we add the largest parts in the partitions to get 15.
MATHEMATICA
Table[(4n^2 - 2n + 1 - (2n^2 - 6n + 1) (-1)^n)/16, {n, 0, 50}]
CoefficientList[Series[- x^2 (x^3 + 2 x + 1)/((x - 1)^3 (x + 1)^3), {x, 0, 50}], x] (* Vincenzo Librandi, Jul 25 2014 *)
LinearRecurrence[{0, 3, 0, -3, 0, 1}, {0, 0, 1, 2, 3, 7}, 60] (* Harvey P. Dale, May 11 2019 *)
PROG
(Magma) [( 4*n^2-2*n+1-(2*n^2-6*n+1)*(-1)^n )/16 : n in [0..50]];
(PARI) concat([0, 0], Vec(-x^2*(x^3+2*x+1)/((x-1)^3*(x+1)^3) + O(x^100))) \\ Colin Barker, Jul 23 2014
(PARI) vector(100, n, n--; if(n%2==0, t=n/2; t*(t+1)/2, t*(3*t + 1)/2)) \\ Altug Alkan, Nov 01 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Jul 23 2014
STATUS
approved