%I #16 Aug 31 2023 10:57:59
%S 1,2,3,1,2,1,1,2,3,1,2,2,1,2,3,1,2,1,1,2,3,1,2,3,1,2,3,1,2,1,1,2,3,1,
%T 2,2,1,2,3,1,2,1,1,2,3,1,2,1,1,2,3,1,2,1,1,2,3,1,2,2,1,2,3,1,2,1,1,2,
%U 3,1,2,3,1,2,3,1,2,1,1,2,3,1,2,2,1,2,3,1,2,1,1,2,3,1,2,2,1,2,3,1,2,1,1,2,3
%N Sequence is S(infinity), where S(1)={1,2,3}, S(n+1)=S(n)S'(n) and S'(n) is obtained from S(n) by changing last term using the cyclic permutation 1->2->3->1.
%H Paolo Xausa, <a href="/A078711/b078711.txt">Table of n, a(n) for n = 1..12288</a>
%F Lim_{n->infinity} Sum_{i=1..n} a(i)/n = 37/21; density of 1's is 3/7; density of 2's is 8/21; density of 3's is 4/21.
%e Concatenating 1,2,3 gives 1,2,3,1,2,3; changing the last term 3 to 1 gives the first 6 terms: 1,2,3,1,2,1. Concatenating those 6 terms: 1,2,3,1,2,1,1,2,3,1,2,1; replacing the last term 1 with 3 gives the first 12 terms: 1,2,3,1,2,1,1,2,3,1,2,2.
%t A078711list[i_]:=Nest[Join[#,Most[#],{Mod[Last[#],3]+1}]&,Range[3],i];
%t A078711list[6] (* Each iteration doubles the number of terms *) (* _Paolo Xausa_, Aug 31 2023 *)
%Y Cf. A010060, A078978, A078979.
%K nonn
%O 1,2
%A _Benoit Cloitre_, Dec 19 2002