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
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0,6,0,-12,0,8).
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
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Dec 18 2019
STATUS
approved