A089650 a(n) = A089649(n) mod 3.
1, 2, 0, 1, 0, 2, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 0, 2, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 0, 2, 1, 1, 1, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 1, 1, 1, 0, 2, 1, 2, 0, 1, 0, 2, 1, 1, 1, 1, 2, 0, 1, 0, 2, 1, 1, 1, 1, 2, 0, 1, 0, 2, 1, 1, 1, 1, 2, 0, 1, 0, 2, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 0, 2, 1, 2, 0, 1, 2, 0
Offset: 1
Programs
-
Mathematica
Nest[ Function[ l, {Flatten[(l /. {0 -> {1, 1, 1}, 1 -> {1, 2, 0}, 2 -> {1, 0, 2}})]}], {0}, 5] (* Robert G. Wilson v, Feb 26 2005 *)
-
PARI
a(n)=if(n<2,1,(a(n-1)+a(floor((n+1)/3)))%3)
Formula
A fixed point of the morphism 1->120, 2->102, 0->111.
Comments