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.

This page as a plain text file.
%I A036585 #29 Jul 08 2025 21:46:13
%S A036585 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,
%T A036585 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,
%U A036585 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
%N A036585 Ternary Thue-Morse sequence: closed under a->abc, b->ac, c->b.
%C A036585 First differences of A001969. Observed by _Franklin T. Adams-Watters_, proved by _Max Alekseyev_, Aug 30 2006
%D A036585 M. Lothaire, Combinatorics on Words. Addison-Wesley, Reading, MA, 1983, p. 26.
%H A036585 Reinhard Zumkeller, <a href="/A036585/b036585.txt">Table of n, a(n) for n = 1..10000</a>
%F A036585 a(n) = A001969(n+1) - A001969(n). - _Franklin T. Adams-Watters_, Aug 28 2006
%F A036585 a(n) = A029883(n) + 2 = A036577(n) + 1.
%t A036585 Differences[ThueMorse[Range[0, 100]]] + 2 (* _Paolo Xausa_, Oct 25 2024 *)
%o A036585 (PARI) a(n)=if(n<1 || valuation(n,2)%2,2,2-(-1)^subst(Pol(binary(n)),x,1))
%o A036585 (Haskell)
%o A036585 a036585 n = a036585_list !! (n-1)
%o A036585 a036585_list = 3 : concat (map f a036585_list)
%o A036585 where f 1 = [1,2,3]; f 2 = [1,3]; f 3 = [2]
%o A036585 -- _Reinhard Zumkeller_, Oct 31 2012
%o A036585 (Python)
%o A036585 def A036585(n): return 2+(n.bit_count()&1)-((n-1).bit_count()&1) # _Chai Wah Wu_, Mar 03 2023
%Y A036585 Cf. A001969, A007413, A005679.
%K A036585 nonn
%O A036585 1,1
%A A036585 _N. J. A. Sloane_