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.

A174314 Sequence given by a(0)=1, a(1)=2 and the recurrence relation: a(n)=a(abs(floor(0.5*n-a(n-2)))) for n>=2.

Original entry on oeis.org

1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 0

Views

Author

Richard Choulet, Mar 15 2010

Keywords

Comments

We observe that the numbers of 1 obtained (between the 2), that is 1, 1, 1, 2, 6, 10, 18, define a sequence v for which v(n)=2^(n-2)+2 for n>=5. In the same vein, the numbers of 2 define a sequence w: 1, 2, 1, 5, for which w(n)=7*2^(n-3)-2. This explain the explicit formulas.

Examples

			a(2)=a(abs(floor(1-1)))=a(0)=1. a(3)=a(abs(floor(1.5-2)))=a(abs(floor(-0.5)))=a(abs(-1))=a(1)=2. a(4)=a(2-a(2))=a(1)=2. If 9*2-4<=n<=11*2-3, that is 14<=n<=19 then a(n)=1. If 11*2-2<=n<=9*2^2-5 that is 20<=n<=31 then a(n)=2.
		

Programs

  • Maple
    u(0):=1:u(1):=2: for n from 2 to 10000 do u(n):=u(abs(floor((1/2)*n-u(n-2)))):od:seq(u(n),n=0..10000);

Formula

For p>=1, if 9*2^p-4<=n<=11*2^p-3, then a(n)=1. For p>=0, if 11*2^p-2<=n<=9*2^(p+1)-5, then a(n)=2.