cp's OEIS Frontend

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.

A036581 Ternary Thue-Morse sequence: closed under a->abc, b->ac, c->b.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

This sequence and A108694 are squarefree (they do not contain any substring XX). - Bill Gosper, Jul 22 2005
Trajectory of 1 under the morphism 0 -> 021, 1 -> 2 & 2 -> 01. - Robert G. Wilson v, Apr 06 2008
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

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.

Crossrefs

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

a(n) = A010060(n+1) - A010060(n) - 1 mod 3. - Bill Gosper, Jul 22 2005

Extensions

More terms from Robert G. Wilson v, Apr 06 2008