login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A330592
a(n) is the number of subsets of {1,2,...,n} that contain exactly two odd numbers.
4
0, 0, 2, 4, 12, 24, 48, 96, 160, 320, 480, 960, 1344, 2688, 3584, 7168, 9216, 18432, 23040, 46080, 56320, 112640, 135168, 270336, 319488, 638976, 745472, 1490944, 1720320, 3440640, 3932160, 7864320, 8912896, 17825792, 20054016, 40108032, 44826624, 89653248
OFFSET
1,3
COMMENTS
2*a(n-1) for n>1 is the number of subsets of {1,2,...,n} that contain exactly two even numbers. For example, for n=5, 2*a(4)=8 and the 8 subsets are {2,4}, {1,2,4}, {2,3,4}, {2,4,5}, {1,2,3,4}, {1,2,4,5}, {2,3,4,5}, {1,2,3,4,5}. - Enrique Navarrete, Dec 20 2019
FORMULA
a(n) = binomial((n+1)/2,2) * 2^((n-1)/2), n odd;
a(n) = binomial(n/2,2) * 2^(n/2), n even.
G.f.: 2*(2*x+1)*x^3/(1-2*x^2)^3.
a(n) = 6*a(n-2) - 12*a(n-4) + 8*a(n-6) for n>6. - Colin Barker, Dec 20 2019
From Amiram Eldar, Mar 24 2022: (Start)
Sum_{n>=3} 1/a(n) = 3*(1-log(2)).
Sum_{n>=3} (-1)^(n+1)/a(n) = 1-log(2). (End)
EXAMPLE
For n=5, a(5)=12 and the 12 subsets are {1,3}, {1,5}, {3,5}, {1,2,3}, {1,2,5}, {1,3,4}, {1,4,5}, {2,3,5}, {3,4,5}, {1,2,3,4}, {1,2,4,5}, {2,3,4,5}.
MATHEMATICA
a[n_] := If[OddQ[n], Binomial[(n + 1)/2, 2]*2^((n - 1)/2), Binomial[n/2, 2]*2^(n/2)]; Array[a, 38] (* Amiram Eldar, Mar 24 2022 *)
PROG
(Magma) [IsEven(n) select Binomial(n div 2, 2)*2^(n div 2) else Binomial((n+1) div 2, 2)*2^((n-1) div 2):n in [1..40]]; // Marius A. Burtea, Dec 19 2019
(PARI) concat([0, 0], Vec(2*x^3*(1 + 2*x) / (1 - 2*x^2)^3 + O(x^40))) \\ Colin Barker, Dec 20 2019
CROSSREFS
Cf. A089822 (with exactly two primes).
Sequence in context: A230481 A212169 A108720 * A089822 A079352 A089888
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Dec 18 2019
STATUS
approved