OFFSET
0,1
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 1028
Index entries for linear recurrences with constant coefficients, signature (2,2,-4).
FORMULA
G.f.: 2*(1-x-x^2)/((1-2*x)*(1-2*x^2)).
a(n) = 2*a(n-1) + 2*a(n-2) - 4*a(n-3).
a(n) = 2^n + Sum_{alpha=RootOf(-1+2*x^2)} alpha^(-n)/2.
a(n) = 2*A051437(n+1), n > 0. - R. J. Mathar, Nov 27 2011
From Colin Barker, Sep 23 2016: (Start)
a(n) = 2^(n/2) + 2^n for n even.
a(n) = 2^n for n odd.
(End)
E.g.f.: (1/2)*(2*exp(2*x) + exp(-sqrt(2)*x) + exp(sqrt(2)*x)). - Stefano Spezia, Oct 22 2019
MAPLE
spec:= [S, {S=Union(Sequence(Prod(Union(Z, Z), Z)), Sequence(Union(Z, Z)))}, unlabeled ]: seq(combstruct[count ](spec, size=n), n=0..20);
seq(coeff(series(2*(1-x-x^2)/((1-2*x)*(1-2*x^2)), x, n+1), x, n), n = 0 .. 40); # G. C. Greubel, Oct 22 2019
MATHEMATICA
CoefficientList[Series[2*(1-x-x^2)/((1-2*x)*(1-2*x^2)), {x, 0, 31}], x] (* Michael De Vlieger, Sep 23 2016 *)
Join[{2}, Table[2^n +2^((n-1)/2)*(1+(-1)^n)/Sqrt[2], {n, 30}]] (* G. C. Greubel, Oct 22 2019 *)
LinearRecurrence[{2, 2, -4}, {2, 2, 6}, 40] (* Harvey P. Dale, Jul 19 2020 *)
PROG
(PARI) a(n)=2^n+if(n%2, , 2^(n/2)) \\ Charles R Greathouse IV, Sep 23 2016
(Magma) [2] cat [Round(2^n +2^((n-1)/2)*(1+(-1)^n)/Sqrt(2)): n in [1..30]]; // G. C. Greubel, Oct 22 2019
(Sage) [2]+[2^n +2^((n-1)/2)*(1+(-1)^n)/sqrt(2) for n in (1..30)] # G. C. Greubel, Oct 22 2019
(GAP) a:=[2, 2, 6];; for n in [4..30] do a[n]:=2*a[n-1]+2*a[n-2]-4*a[n-3]; od; a; # G. C. Greubel, Oct 22 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
encyclopedia(AT)pommard.inria.fr, Jan 25 2000
EXTENSIONS
More terms from James A. Sellers, Jun 05 2000
STATUS
approved