A036581 Ternary Thue-Morse sequence: closed under a->abc, b->ac, c->b.
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, 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, 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
Offset: 0
References
- 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
- M. Lothaire, Combinatorics on Words. Addison-Wesley, Reading, MA, 1983, p. 26.
Links
- R. J. Mathar, Table of n, a(n) for n = 0..10000
- A. Cobham, Uniform Tag Sequences, Mathematical Systems Theory, 6 (1972), 164-192.
- Marston Morse and Gustav A. Hedlund, Unending chess, symbolic dynamics and a problem in semigroups, Duke Math. J., Volume 11, Number 1 (1944), 1-7. - From _N. J. A. Sloane_, Oct 17 2012
- Index entries for sequences that are fixed points of mappings
Programs
-
Haskell
a036581 n = a036581_list !! n a036581_list = zipWith (\u v -> if u /= v then 2 * u + v - 1 else 2) a010060_list $ tail a010060_list -- According to N. J. A. Sloane's comment from Oct 17 2012 -- Reinhard Zumkeller, Nov 30 2012
-
Maple
A036581 := proc(n) A010060(n+1)-A010060(n)-1 ; % mod 3 ; end proc: # R. J. Mathar, Oct 17 2012
-
Mathematica
Nest[ # /. {0 -> {0, 2, 1}, 1 -> {2}, 2 -> {0, 1}} &, {0}, 7] // Flatten (* Robert G. Wilson v, Apr 06 2008 *) 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 *) SubstitutionSystem[{0->{0,2,1},1->{2},2->{0,1}},{0},{7}][[1]] (* Harvey P. Dale, Dec 26 2021 *)
-
Python
def a010060(n): return bin(n)[2:].count("1")%2 def a(n): return (a010060(n + 1) - a010060(n) - 1)%3 # Indranil Ghosh, Apr 25 2017
Formula
Extensions
More terms from Robert G. Wilson v, Apr 06 2008
Comments