%I #22 Oct 31 2017 09:16:37
%S 1,1,1,2,1,1,2,1,2,1,2,1,3,1,1,2,1,2,1,2,1,3,1,2,1,2,1,3,1,2,1,3,1,2,
%T 1,3,1,2,1,1,1,2,1,2,1,2,1,3,1,2,1,2,1,3,1,2,1,3,1,2,1,3,1,2,1,1,2,1,
%U 2,1,3,1,2,1,3,1,2,1,3,1,2,1,1,2,1,3,1,2,1,3,1,2,1,1,2,1,3,1,2,1,1,2,1,3,1
%N Triangle read by rows, based on the morphism f: 1->{1,2}, 2->{1,3}, 3->{1}. First row is 1. If current row is a,b,c,..., then the next row is a,b,c,...,f(a),f(b),f(c),...
%H G. C. Greubel, <a href="/A103684/b103684.txt">Table of n, a(n) for the first 8 rows, flattened</a>
%e [1], [1,1,2], [1,1,2,1,2,1,2,1,3], [1,1,2,1,2,1,2,1,3,1,2,1,2,1,3,1,2,1,3,1,2,1,3,1,2,1], ...
%t NestList[ Flatten[ Join[ #, # /. {1 -> {1, 2}, 2 -> {1, 3}, 3->{1}}]] &, {1}, 4] // Flatten (* _Robert G. Wilson v_, Jul 09 2006 - corrected by _G. C. Greubel_, Oct 26 2017 *)
%o (PARI) {a(n)=local(m,v,w); v=w=[1]; while(length(w)<n, m=length(v); for(k=1,m,v=concat(v,[[1,2],[1,3],[1]][v[k]])); w=concat(w,v)); w[n]} /* _Michael Somos_, Apr 16 2005 */
%Y Cf. A073058, A103685, A103682.
%K nonn,tabf
%O 1,4
%A _Roger L. Bagula_, Mar 26 2005
%E Image of {3} in the definition corrected by _R. J. Mathar_, Nov 18 2010
|