%I #11 Jul 11 2022 13:44:15
%S 0,1,2,2,1,0,1,2,0,1,2,0,2,1,0,0,1,2,2,1,0,1,2,0,0,1,2,2,1,0,1,2,0,0,
%T 1,2,1,2,0,2,1,0,0,1,2,0,1,2,2,1,0,1,2,0,1,2,0,2,1,0,0,1,2,2,1,0,1,2,
%U 0,0,1,2,0,1,2,2,1,0,1,2,0,1,2,0,2,1
%N Start with 0 and repeatedly substitute 0->012, 1->210, 2->120.
%C This is the fixed point of the morphism 0->012, 1->210, 2->120 starting with 0. Let u be the (nonperiodic) sequence of positions of 0, and likewise, v for 1 and w for 2; then u(n)/n -> 3, v(n)/n -> 3, w(n)/n -> 3.
%C See A287385 for a guide to related sequences.
%H Clark Kimberling, <a href="/A287401/b287401.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F a(n) = (2*a(m) + (n-1)*(-1)^a(m)) mod 3, where m = 1 + floor((n-1)/3). - _Max Alekseyev_, Jul 11 2022
%e First three iterations of the morphism: 012, 012210102, 012210102102210012210012102.
%t s = Nest[Flatten[# /. {0->{0, 1, 2}, 1->{2, 1, 0}, 2->{1, 2, 0}}] &, {0}, 9]; (*A287401*)
%t Flatten[Position[s, 0]]; (*A189728*)
%t Flatten[Position[s, 1]]; (*A287403*)
%t Flatten[Position[s, 2]]; (*A287404*)
%Y Cf. A189728, A287385, A287403, A287404.
%K nonn,easy
%O 1,3
%A _Clark Kimberling_, May 25 2017