The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A112387 a(n) = 2^(n/2) if n is even and a(n-1) - a(n-2) if n is odd, a(1) = 1. 4
1, 1, 2, 1, 4, 3, 8, 5, 16, 11, 32, 21, 64, 43, 128, 85, 256, 171, 512, 341, 1024, 683, 2048, 1365, 4096, 2731, 8192, 5461, 16384, 10923, 32768, 21845, 65536, 43691, 131072, 87381, 262144, 174763, 524288, 349525, 1048576, 699051, 2097152, 1398101, 4194304 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
This sequence originated from the Fibonacci sequence, but instead of adding the last two terms, you get the average. Example, if you have the initial condition a(1)=x and a(2)=y, a(3)=(x+y)/2, a(4)=(x+3y)/4, a(5)=(3x+5y)/8, a(6)=(5x+11y)/16 and so on and so forth. I used the coefficients of x and y as well as the denominator.
As n approaches infinity a(n)/a(n+1) oscillates between the values 3/2 and 1/3.
LINKS
FORMULA
a(n) = 2^(n/2) if n is even, a(n) = a(n-1) - a(n-2) if n is odd, and a(1) = 1.
a(2n) = A000079(n), a(2n-1) = A001045(n).
G.f.: (1+x+x^2)/((1+x^2)*(1-2*x^2)). - Joerg Arndt, Apr 25 2021
a(n) = A135318(n + (-1)^n). - Paul Curtz, Sep 27 2023
MAPLE
a:= proc(n) option remember;
`if`(n::even, 2^(n/2), a(n-1)-a(n-2))
end: a(1):=1:
seq(a(n), n=0..50); # Alois P. Heinz, Sep 27 2023
MATHEMATICA
a[1] = 1; a[2] = 2; a[n_] := a[n] = If[ EvenQ[n], 2^(n/2), a[n - 1] - a[n - 2]]; Array[a, 43] (* Robert G. Wilson v, Dec 05 2005 *)
nxt[{n_, a_, b_}]:={n+1, b, If[OddQ[n], 2^((n+1)/2), b-a]}; NestList[nxt, {2, 1, 2}, 50][[All, 2]] (* Harvey P. Dale, Jul 08 2019 *)
CROSSREFS
Sequence in context: A106625 A275902 A008347 * A370727 A193174 A126084
KEYWORD
nonn,easy
AUTHOR
Edwin F. Sampang, Dec 05 2005
EXTENSIONS
Edited and extended by Robert G. Wilson v, Dec 05 2005
a(0)=1 prepended by Alois P. Heinz, Sep 27 2023
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 23 15:23 EDT 2024. Contains 372763 sequences. (Running on oeis4.)