%I #18 Sep 28 2019 22:18:05
%S 1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,2,2,2,2,
%T 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,2,2,
%U 2,2,2,2,1,2,1,2,2,2,1,2,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
%N Trajectory of 1 under the morphism 1->{1,2,1}, 2->{2,2,2}.
%C Dekking substitution for the Cantor set: characteristic polynomial = x^2 - 5*x + 6 of matrix [2, 0; 1, 3].
%C This substitution is useful for computing the devil's staircase by bb=aa/. 1->1/3/. 2->0 /. 3->0; ListPlot[FoldList[Plus, 0, bb], PlotRange -> All, PlotJoined -> True, Axes ->False];
%C The Wikipedia article on L-system Example 3 is "Cantor dust" given by the axiom: A and rules: A -> ABA, B -> BBB. This is isomorphic to the system given in the sequence name. - _Michael Somos_, Jan 12 2015
%H Antti Karttunen, <a href="/A105220/b105220.txt">Table of n, a(n) for n = 0..19682</a>
%H F. M. Dekking, <a href="http://dx.doi.org/10.1016/0001-8708(82)90066-4">Recurrent Sets</a>, Advances in Mathematics, vol. 44, no. 1, 1982, page 99, section 4.15
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/L-system#Example_3:_Cantor_dust">L-system</a> Example 3: Cantor dust
%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F a(n) = 2 - A088917(n) = 1 + A316829(n). - _Antti Karttunen_, Aug 24 2019
%F a(n) = 2 if the ternary expansion of n contains the digit 1, otherwise a(n) = 1. - _Joerg Arndt_, Aug 24 2019
%t Flatten[ Nest[ Flatten[ # /. {1 -> {1, 2, 1}, 2 -> {2, 2, 2}} &], {1}, 5]]
%o (PARI)
%o A088917(n) = { while(n, if(n%3==1, return(0), n\=3)); (1); }; \\ Originally from A005823
%o A105220(n) = (2-A088917(n)); \\ _Antti Karttunen_, Aug 23 2019
%Y Cf. A088917, A316829.
%K nonn
%O 0,2
%A _Roger L. Bagula_, Apr 29 2005