%I #39 Oct 12 2024 01:53:35
%S 0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,
%T 0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,
%U 0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1
%N The Pell word: Fixed point of the morphism 0->001, 1->0.
%C From _Peter Bala_, Nov 22 2013: (Start)
%C This is a Sturmian word: equals the limit word S(infinity) where S(0) = 0, S(1) = 001 and for n >= 1, S(n+1) = S(n)S(n)S(n-1). See the examples below.
%C This sequence corresponds to the case k = 2 of the Sturmian word S_k(infinity) as defined in A080764. See A159684 for the case k = 1. (End)
%C Characteristic word with slope 1 - 1/sqrt(2). Since the characteristic word with slope 1-theta is the mirror image of the characteristic word with slope theta, a(n)= 1 - A080764(n) for all n. - _Michel Dekking_, Jan 31 2017
%C The positions of 0 comprise A001951 (Beatty sequence for sqrt(2)); the positions of 1 comprise A001952 (Beatty sequence for 2+sqrt(2)). - _Clark Kimberling_, May 11 2017
%C This is also the fixed point of the mapping 00->0010, 01->001, 10->010, starting with 00 [Dekking and Keane, 2022]. See A289001. - _N. J. A. Sloane_, Mar 09 2022
%D J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 284.
%H Vincenzo Librandi, <a href="/A171588/b171588.txt">Table of n, a(n) for n = 1..5000</a>
%H Scott Balchin and Dan Rust, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL20/Rust/rust3.html">Computations for Symbolic Substitutions</a>, Journal of Integer Sequences, Vol. 20 (2017), Article 17.4.1.
%H Jean Berstel and Juhani Karhumäki, <a href="http://www-igm.univ-mlv.fr/~berstel/Articles/2003TutorialCoWdec03.pdf">Combinatorics on words-a tutorial</a>. Bull. Eur. Assoc. Theor. Comput. Sci. EATCS, 79:178-228, 2003.
%H Michel Dekking, <a href="http://arxiv.org/abs/1705.08607">Substitution invariant Sturmian words and binary trees</a>, arXiv:1705.08607 [math.CO], 2017.
%H Michel Dekking, <a href="http://math.colgate.edu/~integers/sjs7/sjs7.Abstract.html">Substitution invariant Sturmian words and binary trees</a>, Integers, Electronic Journal of Combinatorial Number Theory 18A (2018), #A17.
%H Michel Dekking and Mike Keane, <a href="https://arxiv.org/abs/2202.13548">Two-block substitutions and morphic words</a>, arXiv:2202.13548 [math.CO], 2022.
%H M. Lothaire, <a href="http://www-igm.univ-mlv.fr/~berstel/Lothaire/">Combinatorics on Words</a>.
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Sturmian_word">Sturmian word</a>
%F a(n) = floor((n + 1)/(2 + sqrt(2))) - floor(n /(2 + sqrt(2))). - _Peter Bala_, Nov 22 2013
%F a(n) = floor((n+1)*(1 - 1/sqrt(2))) - floor(n*(1 - 1/sqrt(2))). - _Michel Dekking_, Jan 31 2017
%e From _Peter Bala_, Nov 22 2013: (Start)
%e The sequence of words S(n) begins
%e S(0) = 0
%e S(1) = 001
%e S(2) = 001 001 0
%e S(3) = 0010010 0010010 001
%e S(4) = 00100100010010001 00100100010010001 0010010.
%e The lengths of the words are [1, 3, 7, 17, 41, ...] = A001333 (apart from the initial term). (End)
%p Digits := 50: u := evalf(2 + sqrt(2)): A171588 := n->floor((n+1)/u) - floor(n/u): seq(A171588(n), n = 1..80); # _Peter Bala_, Nov 22 2013
%t Table[Floor[(n + 1) (1 - 1/Sqrt[2]) - Floor[n (1 - 1/Sqrt[2])]], {n, 100}] (* _Vincenzo Librandi_, Jan 31 2017 *)
%t Nest[Flatten[# /. {0 -> {0, 0, 1}, 1 -> {0}}] &, {0}, 6] (* _Clark Kimberling_, May 11 2017 *)
%o (Magma) [Floor((n+1)*(1-1/Sqrt(2))-Floor(n*(1-1/Sqrt(2)))): n in [1..100]]; // _Vincenzo Librandi_, Jan 31 2017
%Y Cf. A000129, A001333, A001951, A001952, A003849, A080764, A159684, A289001.
%K nonn,easy
%O 1,1
%A Alexis Monnerot-Dumaine (alexis.monnerotdumaine(AT)gmail.com), Dec 12 2009