| MATHEMATICA
|
m = 121; (* number of terms required *)
S[1] = {1};
S[n_] := S[n] = SubstitutionSystem[{1 -> {1, 2}, 2 -> {3}, 3 -> {1, 2}}, S[n-1]];
For[n = 2, True, n++, If[PadRight[S[n], m] == PadRight[S[n-1], m], Print["n = ", n]; Break[]]];
Take[S[n], m] (* Jean-François Alcover, Feb 15 2023 *)
|