[go: up one dir, main page]

login
A052552
a(2*n+1) = 1, a(2*n) = 2*a(2*n-2) - 1.
2
2, 1, 3, 1, 5, 1, 9, 1, 17, 1, 33, 1, 65, 1, 129, 1, 257, 1, 513, 1, 1025, 1, 2049, 1, 4097, 1, 8193, 1, 16385, 1, 32769, 1, 65537, 1, 131073, 1, 262145, 1, 524289, 1, 1048577, 1, 2097153, 1, 4194305, 1, 8388609, 1, 16777217, 1, 33554433, 1, 67108865, 1
OFFSET
0,1
COMMENTS
Interleaving of A000051 and A000012. - Klaus Brockhaus, Jun 27 2011
FORMULA
G.f.: (2 - x - 2*x^2)/((1-2*x^2)*(1-x)).
a(n) = +a(n-1) +2*a(n-2) -2*a(n-3).
a(n) = 1 + Sum(1/2*_alpha^(-n), _alpha=RootOf(-1+2*_Z^2)).
a(n) = abs(a(n-1)-a(n-2)-a(n-1)*a(n-2)), a(0)=2, a(1)=1. - Pasi Airikka, Jun 27 2011
a(n) = 1 + (1+(-1)^n)*sqrt(2)^(n-2). - Bruno Berselli, Jun 27 2011
MAPLE
spec := [S, {S=Union(Sequence(Prod(Z, Union(Z, Z))), Sequence(Z))}, unlabeled]: seq(combstruct[count](spec, size=n), n=0..20);
MATHEMATICA
LinearRecurrence[{1, 2, -2}, {2, 1, 3}, 60] (* G. C. Greubel, May 07 2019 *)
PROG
(Magma) [ n eq 1 select 2 else IsOdd(n) select 2*Self(n-2)-1 else 1: n in [1..60] ]; // Klaus Brockhaus, Jun 27 2011
(Magma) I:=[ 2, 1 ]; [ n le 2 select I[n] else Abs(Self(n-1)-Self(n-2)-Self(n-1)*Self(n-2)): n in [1..60] ]; // Klaus Brockhaus, Jun 27 2011
(PARI) my(x='x+O('x^60)); Vec((2-x-2*x^2)/((1-2*x^2)*(1-x))) \\ G. C. Greubel, May 07 2019
(Sage) ((2-x-2*x^2)/((1-2*x^2)*(1-x))).series(x, 60).coefficients(x, sparse=False) # G. C. Greubel, May 07 2019
(GAP) a:=[2, 1, 3];; for n in [4..60] do a[n]:=a[n-1]+2*a[n-2]-2*a[n-3]; od; a; # G. C. Greubel, May 07 2019
CROSSREFS
Sequence in context: A336752 A126132 A129982 * A147000 A147486 A168018
KEYWORD
easy,nonn
AUTHOR
encyclopedia(AT)pommard.inria.fr, Jan 25 2000
EXTENSIONS
More terms from James A. Sellers, Jun 05 2000
STATUS
approved