login
a(n) = 2*(n^2 + 1) + n*(1 + (-1)^n).
2

%I #27 Sep 08 2022 08:46:09

%S 2,4,14,20,42,52,86,100,146,164,222,244,314,340,422,452,546,580,686,

%T 724,842,884,1014,1060,1202,1252,1406,1460,1626,1684,1862,1924,2114,

%U 2180,2382,2452,2666,2740,2966,3044,3282,3364,3614,3700,3962,4052,4326,4420

%N a(n) = 2*(n^2 + 1) + n*(1 + (-1)^n).

%C Sum of the parts in the partitions of 2n+2 and 2n-2 into two odd parts.

%H Michael De Vlieger, <a href="/A245764/b245764.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Par#part">Index entries for sequences related to partitions</a>

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

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

%F Recurrence: a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5), n>4.

%F a(n) = 2*(n^2 + 1) + n*(1 + (-1)^n).

%F a(n) = (2n + 2)*ceiling((n + 1)/2) + (2n - 2)*ceiling((n - 1)/2).

%e a(0) = 2; There are no partitions of 2(0)-2 = -2, and the odd partitions of 2(0)+2 = 2 into two odd parts is (1,1). The sum of these parts is 2.

%e a(2) = 14; The partitions of 2(2)-2 = 2 into two odd parts is (1,1) and the partitions of 2(2)+2 = 6 into two odd parts is (5,1) and (3,3). The sum of the parts in these partitions is 1 + 1 + 5 + 1 + 3 + 3 = 14.

%p A245764:=n->2*(n^2 + 1) + n*(1 + (-1)^n): seq(A245764(n), n=0..50);

%t Table[2n^2 + n + 2 + n(-1)^n, {n, 0, 50}]

%t CoefficientList[Series[2 (1 + x^2) (1 + x + 2 x^2)/((1 - x)^3 (1 + x)^2), {x, 0, 50}], x]

%o (Magma) [2*(n^2 + 1) + n*(1 + (-1)^n) : n in [0..50]];

%o (PARI) vector(100, n, 2*((n-1)^2 + 1) + (n-1)*(1 - (-1)^n)) \\ _Derek Orr_, Jul 31 2014

%o (GAP) List([0..10^3], n->2*(n^2+1)+n*(1+(-1)^n)); # _Muniru A Asiru_, Feb 04 2018

%Y Cf. A245766.

%K nonn,easy

%O 0,1

%A _Wesley Ivan Hurt_, Jul 31 2014