login
Image of 3 under repeated applications of the morphism 1 -> 11, 2 -> 2, 3 -> 312.
0

%I #12 May 14 2022 11:20:53

%S 3,312,312112,31211211112,31211211112111111112,

%T 3121121111211111111211111111111111112,

%U 3121121111211111111211111111111111112111111111111111111111111111111112

%N Image of 3 under repeated applications of the morphism 1 -> 11, 2 -> 2, 3 -> 312.

%C a(n) has length 2^n + n.

%D J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, Problem 4, p. 242.

%p b:= proc(n) option remember; `if`(n=0, 3, (l-> subs(3=

%p [3, 1, 2][], subs(1=[1$2][], l))[])([b(n-1)])) end:

%p a:= n-> parse(cat(b(n))):

%p seq(a(n), n=0..6); # _Alois P. Heinz_, May 26 2021

%t FromDigits /@ SubstitutionSystem[{1 -> {1, 1}, 2 -> {2}, 3 -> {3, 1, 2}}, {3}, 6] (* _Jean-François Alcover_, May 14 2022 *)

%K nonn

%O 0,1

%A _N. J. A. Sloane_, Jul 14 2018

%E a(2) corrected by _Georg Fischer_, May 26 2021