login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A052531 If n is even then 2^n+1 otherwise 2^n. 3
2, 2, 5, 8, 17, 32, 65, 128, 257, 512, 1025, 2048, 4097, 8192, 16385, 32768, 65537, 131072, 262145, 524288, 1048577, 2097152, 4194305, 8388608, 16777217, 33554432, 67108865, 134217728, 268435457, 536870912, 1073741825, 2147483648 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

LINKS

G. C. Greubel, Table of n, a(n) for n = 0..1000

INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 461

Index entries for linear recurrences with constant coefficients, signature (2,1,-2).

FORMULA

G.f.: (2 - 2*x - x^2)/( (1-x^2)*(1-2*x) ).

a(n) = a(n-1) + 2*a(n-2) - 1, with a(0) = 2, a(1) = 2, a(2) = 5.

a(n) = 2^n + Sum_{alpha = RootOf(-1+x^2)} alpha^(-n)/2.

a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3), with a(0) = 2, a(1) = 2, a(2) = 5. - G. C. Greubel, May 09 2019

a(n) = 2^n + (1 + (-1)^n)/2. - G. C. Greubel, Oct 17 2019

E.g.f.: exp(2*x) + cosh(x). - Stefano Spezia, Oct 18 2019

MAPLE

spec:= [S, {S=Union(Sequence(Union(Z, Z)), Sequence(Prod(Z, Z)))}, unlabeled]: seq(combstruct[count](spec, size=n), n=0..20);

seq(2^n + (1+(-1)^n)/2, n=0..30); # G. C. Greubel, Oct 17 2019

MATHEMATICA

2^# + (1 - Mod[#, 2]) & /@ Range[0, 40] (* Peter Pein, Jan 11 2008 *)

Table[If[EvenQ[n], 2^n + 1, 2^n], {n, 0, 40}] (* Vladimir Joseph Stephan Orlovsky, Feb 07 2010, modified by G. C. Greubel, May 09 2019 *)

Table[2^n + Boole[EvenQ[n]], {n, 0, 31}] (* Alonso del Arte, May 09 2019 *)

PROG

(PARI) my(x='x+O('x^40)); Vec((2-2*x-x^2)/((1-x^2)*(1-2*x))) \\ G. C. Greubel, May 09 2019

(PARI) a(n) = 1<<n + 1 - (n%2) \\ David A. Corneth, Oct 18 2019

(MAGMA) [2^n + (1+(-1)^n)/2: n in [0..30]]; // G. C. Greubel, May 09 2019

(Sage) [2^n + (1+(-1)^n)/2 for n in (0..30)] # G. C. Greubel, May 09 2019

(GAP) a:=[2, 2, 5];; for n in [4..40] do a[n]:=2*a[n-1]+a[n-2]-2*a[n-3]; od; a; # G. C. Greubel, May 09 2019

CROSSREFS

Cf. A001045, A042950, A052929, A062510, A087288, A280345.

Sequence in context: A246807 A077902 A005834 * A257517 A095005 A209066

Adjacent sequences:  A052528 A052529 A052530 * A052532 A052533 A052534

KEYWORD

easy,nonn

AUTHOR

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

EXTENSIONS

More terms from James A. Sellers, Jun 05 2000

Better definition from Peter Pein (petsie(AT)dordos.net), Jan 11 2008

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 07:59 EDT 2020. Contains 333079 sequences. (Running on oeis4.)