A331574 a(n) is the number of subsets of {1..n} that contain 3 even and 3 odd numbers.
0, 0, 0, 0, 0, 0, 1, 4, 16, 40, 100, 200, 400, 700, 1225, 1960, 3136, 4704, 7056, 10080, 14400, 19800, 27225, 36300, 48400, 62920, 81796, 104104, 132496, 165620, 207025, 254800, 313600, 380800, 462400, 554880, 665856, 790704, 938961, 1104660, 1299600, 1516200, 1768900, 2048200, 2371600
Offset: 0
Examples
a(7) = 4 and the 4 subsets are {1,2,3,4,5,6}, {1,2,3,4,6,7}, {1,2,4,5,6,7}, {2,3,4,5,6,7}.
Links
- Index entries for linear recurrences with constant coefficients, signature (2,4,-10,-5,20,0,-20,5,10,-4,-2,1).
Crossrefs
Cf. A028723 (2 even and 2 odd numbers).
Programs
-
Magma
[IsEven(n) select Binomial((n div 2),3)^2 else Binomial((n-1) div 2,3)*Binomial((n+1) div 2,3): n in [0..45]]; // Marius A. Burtea, Jan 21 2020
-
Maple
a:= n-> ((b, q)-> b(q, 3)*b(n-q, 3))(binomial, iquo(n, 2)): seq(a(n), n=0..50); # Alois P. Heinz, Jan 30 2020
-
Mathematica
a[n_] := If[OddQ[n], Binomial[(n - 1)/2, 3]*Binomial[(n + 1)/2, 3], Binomial[n/2, 3]^2]; Array[a, 45, 0] (* Amiram Eldar, Jan 21 2020 *) LinearRecurrence[{2,4,-10,-5,20,0,-20,5,10,-4,-2,1},{0,0,0,0,0,0,1,4,16,40,100,200},50] (* Harvey P. Dale, Dec 17 2022 *)
-
PARI
concat([0,0,0,0,0,0], Vec(x^6*(1 + 2*x + 4*x^2 + 2*x^3 + x^4) / ((1 - x)^7*(1 + x)^5) + O(x^40))) \\ Colin Barker, Jan 21 2020
Formula
a(n) = binomial(n/2,3)^2, n even;
a(n) = binomial((n-1)/2,3)*binomial((n+1)/2,3), n odd.
From Colin Barker, Jan 21 2020: (Start)
G.f.: x^6*(1 + 2*x + 4*x^2 + 2*x^3 + x^4) / ((1 - x)^7*(1 + x)^5).
a(n) = 2*a(n-1) + 4*a(n-2) - 10*a(n-3) - 5*a(n-4) + 20*a(n-5) - 20*a(n-7) + 5*a(n-8) + 10*a(n-9) - 4*a(n-10) - 2*a(n-11) + a(n-12) for n>11.
(End)
E.g.f.: (cosh(x)-sinh(x))*(45+36*x+18*x^2+6*x^3+3*x^4+(-45+54*x-36*x^2+18*x^3-9*x^4+6*x^5+2*x^6)*(cosh(2*x)+sinh(2*x)))/4608. - Stefano Spezia, Jan 27 2020