cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A052957 Expansion of 2*(1-x-x^2)/((1-2*x)*(1-2*x^2)).

Original entry on oeis.org

2, 2, 6, 8, 20, 32, 72, 128, 272, 512, 1056, 2048, 4160, 8192, 16512, 32768, 65792, 131072, 262656, 524288, 1049600, 2097152, 4196352, 8388608, 16781312, 33554432, 67117056, 134217728, 268451840, 536870912, 1073774592, 2147483648
Offset: 0

Views

Author

encyclopedia(AT)pommard.inria.fr, Jan 25 2000

Keywords

Programs

  • 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
  • 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
    
  • 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 *)
  • PARI
    a(n)=2^n+if(n%2,,2^(n/2)) \\ Charles R Greathouse IV, Sep 23 2016
    
  • Sage
    [2]+[2^n +2^((n-1)/2)*(1+(-1)^n)/sqrt(2) for n in (1..30)] # G. C. Greubel, Oct 22 2019
    

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

Extensions

More terms from James Sellers, Jun 05 2000