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”).
%I #27 Mar 24 2022 08:43:58
%S 0,0,2,4,12,24,48,96,160,320,480,960,1344,2688,3584,7168,9216,18432,
%T 23040,46080,56320,112640,135168,270336,319488,638976,745472,1490944,
%U 1720320,3440640,3932160,7864320,8912896,17825792,20054016,40108032,44826624,89653248
%N a(n) is the number of subsets of {1,2,...,n} that contain exactly two odd numbers.
%C 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
%H Colin Barker, <a href="/A330592/b330592.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,6,0,-12,0,8).
%F a(n) = binomial((n+1)/2,2) * 2^((n-1)/2), n odd;
%F a(n) = binomial(n/2,2) * 2^(n/2), n even.
%F G.f.: 2*(2*x+1)*x^3/(1-2*x^2)^3.
%F a(n) = 6*a(n-2) - 12*a(n-4) + 8*a(n-6) for n>6. - _Colin Barker_, Dec 20 2019
%F From _Amiram Eldar_, Mar 24 2022: (Start)
%F Sum_{n>=3} 1/a(n) = 3*(1-log(2)).
%F Sum_{n>=3} (-1)^(n+1)/a(n) = 1-log(2). (End)
%e 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}.
%t 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 *)
%o (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
%o (PARI) concat([0,0], Vec(2*x^3*(1 + 2*x) / (1 - 2*x^2)^3 + O(x^40))) \\ _Colin Barker_, Dec 20 2019
%Y Cf. A089822 (with exactly two primes).
%K nonn,easy
%O 1,3
%A _Enrique Navarrete_, Dec 18 2019