login
Number of 3-element subsets of S = {1..n} whose sum is odd.
1

%I #50 Aug 19 2018 16:27:12

%S 0,0,0,0,2,4,10,16,28,40,60,80,110,140,182,224,280,336,408,480,570,

%T 660,770,880,1012,1144,1300,1456,1638,1820,2030,2240,2480,2720,2992,

%U 3264,3570,3876,4218,4560,4940,5320,5740,6160,6622,7084,7590,8096,8648,9200

%N Number of 3-element subsets of S = {1..n} whose sum is odd.

%C The same as A006584 (apart from the offset). - _R. J. Mathar_, Jan 15 2017

%C There are two cases: n is odd and n is even.

%C Let n be an odd integer and n > 3, the sum of 3 integers is odd when all of them are odd or one is odd and the others are even. Number of ways to choose 3 odd numbers: C((n+1)/2, 3). Number of ways to choose 2 even numbers and 1 odd: C((n-1)/2, 2)*C((n+1)/2, 1). Total number of ways: C((n+1)/2, 3) + C((n-1)/2, 2)*C((n+1)/2,1).

%C Let n be an even integer and n > 3. Number of ways to choose 3 odd numbers: C(n/2, 3). Number of ways to choose 2 even numbers and 1 odd: C(n/2, 2)*C(n/2, 1). Total number of ways: C(n/2, 3) + C(n/2, 2)*C(n/2, 1).

%C Take a chessboard of n X n unit squares in which the a1 square is black. a(n) is the number of composite squares having white unit squares on their vertices. For the number of composite squares having black unit squares on their vertices see A005993. - _Ivan N. Ianakiev_, Aug 19 2018

%H Colin Barker, <a href="/A280186/b280186.txt">Table of n, a(n) for n = 0..1000</a>

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

%F a(n) = C((n+1)/2, 3) + C((n-1)/2, 2)*C((n+1)/2,1) when n is odd.

%F a(n) = C(n/2, 3) + C(n/2, 2)*C(n/2, 1) when n is even.

%F From _Colin Barker_, Dec 28 2016: (Start)

%F a(n) = 2*a(n-1) + a(n-2) - 4*a(n-3) + a(n-4) + 2*a(n-5) - a(n-6) for n>5.

%F a(n) = n*(n - 1)*(n - 2)/12 for n even.

%F a(n) = (n - 1)*(n + 1)*(n - 3)/12 for n odd.

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

%F a(n) = ((-1)^n)*(-1+n)*(3 - 3*(-1)^n - 4*((-1)^n)*n + 2*((-1)^n)*n^2)/24. - _Ivan N. Ianakiev_, Aug 19 2018

%e For n = 5 then a(5) = 4. The subsets are: {1, 2, 4}, {1, 3, 5}, {2, 3, 4}, {2, 4, 5}.

%t Table[Binomial[(n + #)/2, 3] + Binomial[(n - #)/2, 2] Binomial[(n + #)/2, 1] &@ Boole@ OddQ@ n, {n, 0, 49}] (* or *)

%t CoefficientList[Series[2 x^4/((1 - x)^4*(1 + x)^2), {x, 0, 49}], x] (* _Michael De Vlieger_, Jan 07 2017 *)

%o (PARI) concat(vector(4), Vec(2*x^4 / ((1-x)^4*(1+x)^2) + O(x^60))) \\ _Colin Barker_, Dec 28 2016

%Y Essentially 2*A006918.

%Y Same as A006584.

%K nonn,easy

%O 0,5

%A _Necip Fazil Patat_, Dec 28 2016

%E More terms from _Colin Barker_, Dec 28 2016