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.

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

Original entry on oeis.org

3, 2, 1, 3, 1, 2, 3, 2, 1, 2, 3, 1, 3, 2, 1, 3, 1, 2, 3, 1, 3, 2, 1, 2, 3, 2, 1, 3, 1, 2, 3, 2, 1, 2, 3, 1, 3, 2, 1, 2, 3, 2, 1, 3, 1, 2, 3, 1, 3, 2, 1, 3, 1, 2, 3, 2, 1, 2, 3, 1, 3, 2, 1, 3, 1, 2, 3, 1, 3, 2, 1, 2, 3, 2, 1, 3, 1, 2, 3, 1, 3, 2, 1, 3, 1, 2, 3, 2, 1, 2, 3, 1, 3, 2, 1, 2, 3, 2, 1, 3, 1, 2, 3, 2, 1
Offset: 1

Views

Author

Keywords

Comments

First differences of A001969. Observed by Franklin T. Adams-Watters, proved by Max Alekseyev, Aug 30 2006

References

  • M. Lothaire, Combinatorics on Words. Addison-Wesley, Reading, MA, 1983, p. 26.

Crossrefs

Programs

  • Haskell
    a036585 n = a036585_list !! (n-1)
    a036585_list = 3 : concat (map f a036585_list)
    where f 1 = [1,2,3]; f 2 = [1,3]; f 3 = [2]
    -- Reinhard Zumkeller, Oct 31 2012
    
  • Mathematica
    Differences[ThueMorse[Range[0, 100]]] + 2 (* Paolo Xausa, Oct 25 2024 *)
  • PARI
    a(n)=if(n<1 || valuation(n,2)%2,2,2-(-1)^subst(Pol(binary(n)),x,1))
    
  • Python
    def A036585(n): return 2+(n.bit_count()&1)-((n-1).bit_count()&1) # Chai Wah Wu, Mar 03 2023

Formula

a(n) = A001969(n+1) - A001969(n). - Franklin T. Adams-Watters, Aug 28 2006
a(n) = A029883(n) + 2 = A036577(n) + 1.