This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A036581 #46 Apr 15 2024 11:24:15 %S A036581 0,2,1,0,1,2,0,2,1,2,0,1,0,2,1,0,1,2,0,1,0,2,1,2,0,2,1,0,1,2,0,2,1,2, %T A036581 0,1,0,2,1,2,0,2,1,0,1,2,0,1,0,2,1,0,1,2,0,2,1,2,0,1,0,2,1,0,1,2,0,1, %U A036581 0,2,1,2,0,2,1,0,1,2,0,1,0,2,1,0,1,2,0,2,1,2,0,1,0,2,1,2,0,2,1 %N A036581 Ternary Thue-Morse sequence: closed under a->abc, b->ac, c->b. %C A036581 This sequence and A108694 are squarefree (they do not contain any substring XX). - _Bill Gosper_, Jul 22 2005 %C A036581 Trajectory of 1 under the morphism 0 -> 021, 1 -> 2 & 2 -> 01. - _Robert G. Wilson v_, Apr 06 2008 %C A036581 I believe that this is the sequence Cummings refers to as the Morse-Hedlund sequence. It can be constructed by starting with the Thue-Morse binary sequence A010060, 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,..., reading successive pairs of digits: 01, 11, 10, 01, 10, 00, 01, 11, 10, 00, 01, ..., and mapping 01 to 0, 10 to 1, and both 00 and 11 to 2, getting 0,2,1,0,1,2,0,2,1,... - _N. J. A. Sloane_, Oct 17 2012 %D A036581 L. J. Cummings, On the construction of Thue sequences, Proc. 9th S-E Conf. Combinatorics, Graph Theory and Computing, pp. 235-242. - From _N. J. A. Sloane_, Oct 17 2012 %D A036581 M. Lothaire, Combinatorics on Words. Addison-Wesley, Reading, MA, 1983, p. 26. %H A036581 R. J. Mathar, <a href="/A036581/b036581.txt">Table of n, a(n) for n = 0..10000</a> %H A036581 A. Cobham, <a href="http://dx.doi.org/10.1007/BF01706087">Uniform Tag Sequences</a>, Mathematical Systems Theory, 6 (1972), 164-192. %H A036581 Marston Morse and Gustav A. Hedlund, <a href="http://dx.doi.org/10.1215/S0012-7094-44-01101-4">Unending chess, symbolic dynamics and a problem in semigroups</a>, Duke Math. J., Volume 11, Number 1 (1944), 1-7. - From _N. J. A. Sloane_, Oct 17 2012 %H A036581 <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a> %F A036581 a(n) = A010060(n+1) - A010060(n) - 1 mod 3. - _Bill Gosper_, Jul 22 2005 %p A036581 A036581 := proc(n) %p A036581 A010060(n+1)-A010060(n)-1 ; %p A036581 % mod 3 ; %p A036581 end proc: # _R. J. Mathar_, Oct 17 2012 %t A036581 Nest[ # /. {0 -> {0, 2, 1}, 1 -> {2}, 2 -> {0, 1}} &, {0}, 7] // Flatten (* _Robert G. Wilson v_, Apr 06 2008 *) %t A036581 a010060[n_]:=Mod[DigitCount[n, 2, 1], 2]; Table[Mod[a010060[n + 1] - a010060[n] - 1, 3], {n, 0, 100}] (* _Indranil Ghosh_, Apr 25 2017 *) %t A036581 SubstitutionSystem[{0->{0,2,1},1->{2},2->{0,1}},{0},{7}][[1]] (* _Harvey P. Dale_, Dec 26 2021 *) %o A036581 (Haskell) %o A036581 a036581 n = a036581_list !! n %o A036581 a036581_list = zipWith (\u v -> if u /= v then 2 * u + v - 1 else 2) %o A036581 a010060_list $ tail a010060_list %o A036581 -- According to _N. J. A. Sloane_'s comment from Oct 17 2012 %o A036581 -- _Reinhard Zumkeller_, Nov 30 2012 %o A036581 (Python) %o A036581 def a010060(n): return bin(n)[2:].count("1")%2 %o A036581 def a(n): return (a010060(n + 1) - a010060(n) - 1)%3 # _Indranil Ghosh_, Apr 25 2017 %Y A036581 Cf. A036583, A108694. %K A036581 nonn,nice %O A036581 0,2 %A A036581 _N. J. A. Sloane_ %E A036581 More terms from _Robert G. Wilson v_, Apr 06 2008