A330298 a(n) is the number of subsets of {1..n} that contain exactly 1 odd and 2 even numbers.
0, 0, 0, 0, 2, 3, 9, 12, 24, 30, 50, 60, 90, 105, 147, 168, 224, 252, 324, 360, 450, 495, 605, 660, 792, 858, 1014, 1092, 1274, 1365, 1575, 1680, 1920, 2040, 2312, 2448, 2754, 2907, 3249, 3420, 3800, 3990, 4410, 4620, 5082, 5313, 5819, 6072, 6624, 6900, 7500, 7800, 8450, 8775, 9477
Offset: 0
Examples
For n=6, a(6) = 9 and the 9 subsets are: {1,2,4}, {1,2,6}, {1,4,6}, {2,3,4}, {2,3,6}, {2,4,5}, {2,5,6}, {3,4,6}, {4,5,6}.
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- J.S. Seneschal, Oblong Prism Illustration
- Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1).
Crossrefs
Programs
-
Mathematica
a[n_] := Ceiling[n/2] * Binomial[Floor[n/2], 2]; Array[a, 55, 0] (* Amiram Eldar, Mar 01 2020 *) Table[Length[Select[Subsets[Range[n],{3}],Total[Boole[OddQ[#]]]==1&]],{n,0,60}] (* Harvey P. Dale, Jul 26 2020 *)
-
PARI
a(n) = ceil(n/2) * binomial(floor(n/2), 2) \\ Andrew Howroyd, Mar 01 2020
-
PARI
concat([0,0,0,0], Vec(x^4*(2 + x) / ((1 - x)^4*(1 + x)^3) + O(x^40))) \\ Colin Barker, Mar 02 2020
Formula
a(n) = ceiling(n/2) * binomial(floor(n/2), 2).
From Colin Barker, Mar 01 2020: (Start)
G.f.: x^4*(2 + x) / ((1 - x)^4*(1 + x)^3).
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) for n>6. (End)
E.g.f.: (x*(-3 + x + x^2)*cosh(x) + (3 - x + x^3)*sinh(x))/16. - Stefano Spezia, Mar 02 2020
a(n) = 3/32-5*n^2/32-n/32+n^3/16+(-)^n*(n-3+n^2)/32. - R. J. Mathar, Mar 31 2025
Comments