%I #20 Sep 05 2020 03:40:46
%S 1,2,1,3,1,2,4,3,1,2,1,3,4,2,4,3,1,2,1,3,1,2,4,3,4,2,1,3,4,2,4,3,1,2,
%T 1,3,1,2,4,3,1,2,1,3,4,2,4,3,4,2,1,3,1,2,4,3,4,2,1,3,4,2,4,3,1,2,1,3,
%U 1,2,4,3,1,2,1,3,4,2,4,3,1,2,1,3,1,2,4,3,4,2,1,3,4,2,4,3,4,2,1,3,1,2,4,3,1
%N Infinite word generated by mapping 1->12, 2->13, 3->43, 4->42 starting at 1.
%C Infinite word over 4-letter alphabet that contains no squares in arithmetic progressions of odd difference. - _Ralf Stephan_, May 09 2007
%H Jui-Yi Kao, Narad Rampersad, Jeffrey Shallit, Manuel Silva, <a href="https://doi.org/10.1016/j.tcs.2007.10.039">Words avoiding repetitions in arithmetic progressions</a>, Theoretical Computer Science, volume 391, issues 1-2, February 2008, pages 126-137. And <a href="https://arxiv.org/abs/math/0608607">arXiv:math/0608607</a> [math.CO], 2006.
%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F Recurrence: a(1)=1, a(4n)=3, a(4n+2)=2, a(8n+3)=1, a(8n+7)=4, a(4n+1)=a(2n+1). - _Ralf Stephan_, May 09 2007
%e 1 -> 12 -> 1213 -> 12131242 -> 1213124312134243 -> ...
%t SubstitutionSystem[{1 -> {1, 2}, 2 -> {1, 3}, 3 -> {4, 3}, 4 -> {4, 2}}, {1}, 7] // Last (* _Jean-François Alcover_, Dec 17 2018 *)
%o (PARI) {a(n)=local(A); if(n<1, 0, A=[1]; while(length(A)<n, A=concat(vector(length(A), k, [[1, 2], [1, 3], [4, 3], [4, 2]][A[k]]))); A[n])}
%o (PARI) my(table=[1,2;4,3]); a(n) = n--; table[if(n,bittest(n,1+valuation(n,2)))+1, n%2+1]; \\ _Kevin Ryde_, Sep 05 2020
%Y Essentially the same: A112658 (map 1234 -> 1023), A122002 (map 1234 -> 5137).
%Y Cf. A038190.
%K nonn
%O 1,2
%A _Michael Somos_, Nov 17 2006