login
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.
2
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,2
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.
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.
EXAMPLE
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.
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);
CROSSREFS
Sequence in context: A049710 A352632 A025143 * A237253 A080634 A109925
KEYWORD
easy,nonn
AUTHOR
Richard Choulet, Mar 15 2010
STATUS
approved