login
The infinite Fibonacci word: start with 1, repeatedly apply the morphism 1->12, 2->1, take limit; or, start with S(0)=2, S(1)=1, and for n>1 define S(n)=S(n-1)S(n-2), then the sequence is S(oo).
52

%I #164 Mar 30 2023 05:13:05

%S 1,2,1,1,2,1,2,1,1,2,1,1,2,1,2,1,1,2,1,2,1,1,2,1,1,2,1,2,1,1,2,1,1,2,

%T 1,2,1,1,2,1,2,1,1,2,1,1,2,1,2,1,1,2,1,2,1,1,2,1,1,2,1,2,1,1,2,1,1,2,

%U 1,2,1,1,2,1,2,1,1,2,1,1,2,1,2,1,1,2,1,1,2,1,2,1,1,2,1,2,1,1,2,1,1,2,1,2,1

%N The infinite Fibonacci word: start with 1, repeatedly apply the morphism 1->12, 2->1, take limit; or, start with S(0)=2, S(1)=1, and for n>1 define S(n)=S(n-1)S(n-2), then the sequence is S(oo).

%C Or, fixed point of the morphism 1->12, 2->1, starting from a(1) = 2.

%C A Sturmian word, as are all versions of this sequence. This means that if one slides a window of length n along the sequence, one sees exactly n+1 different subwords (see A213975). For a proof, see for example Chap. 2 of Lothaire (2002).

%C The limiting mean of the first n terms is 3 - phi, where phi is the golden ratio (A001622); the limiting variance is 2 - phi. - _Clark Kimberling_, Mar 12 2014

%C The Wikipedia article on L-system Example 1 is "Algae" given by the axiom: A and rules: A -> AB, B -> A. The sequence G(n) = G(n-1)G(n-2) yields this sequence when A -> 1, B -> 2. - _Michael Somos_, Jan 12 2015

%C In the limit #1's : #2's = phi : 1. - _Frank M Jackson_, Mar 12 2018

%D J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003.

%D Jean Berstel, "Fibonacci words—a survey." In The book of L, pp. 13-27. Springer Berlin Heidelberg, 1986.

%D J. Berstel and J. Karhumaki, Combinatorics on words - a tutorial, Bull. EATCS, #79 (2003), pp. 178-228.

%D E. Bombieri and J. Taylor, Which distribution of matter diffracts? An initial investigation, in International Workshop on Aperiodic Crystals (Les Houches, 1986), J. de Physique, Colloq. C3, 47 (1986), C3-19 to C3-28.

%D Aldo de Luca and Stefano Varricchio, Finiteness and regularity in semigroups and formal languages. Monographs in Theoretical Computer Science. An EATCS Series. Springer-Verlag, Berlin, 1999. x+240 pp. ISBN: 3-540-63771-0 MR1696498 (2000g:68001). See p. 25.

%D J. C. Lagarias, Number Theory and Dynamical Systems, pp. 35-72 of S. A. Burr, ed., The Unreasonable Effectiveness of Number Theory, Proc. Sympos. Appl. Math., 46 (1992). Amer. Math. Soc. - see p. 64.

%D G. Melançon, Factorizing infinite words using Maple, MapleTech journal, vol. 4, no. 1, 1997, pp. 34-42, esp. p. 36.

%H T. D. Noe, <a href="/A003842/b003842.txt">Table of n, a(n) for n=0..10945</a> (20 iterations)

%H J.-P. Allouche and M. Mendes France, <a href="https://webusers.imj-prg.fr/~jean-paul.allouche/allmendeshouches.pdf">Automata and Automatic Sequences</a>, in: Axel F. and Gratias D. (eds), Beyond Quasicrystals. Centre de Physique des Houches, vol 3. Springer, Berlin, Heidelberg, pp. 293-367, 1995; DOI https://doi.org/10.1007/978-3-662-03130-8_11.

%H J.-P. Allouche and M. Mendes France, <a href="/A003842/a003842.pdf">Automata and Automatic Sequences</a>, in: Axel F. and Gratias D. (eds), Beyond Quasicrystals. Centre de Physique des Houches, vol 3. Springer, Berlin, Heidelberg, pp. 293-367, 1995; DOI https://doi.org/10.1007/978-3-662-03130-8_11. [Local copy]

%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, <a href="http://www-igm.univ-mlv.fr/~berstel/">Home Page</a>

%H Julien Cassaigne, <a href="http://www.numdam.org/item?id=ITA_2008__42_4_701_0">On extremal properties of the Fibonacci word</a>, RAIRO-Theor. Inf. Appl. 42 (2008) 701-715.

%H J. Endrullis, D. Hendriks and J. W. Klop, <a href="http://joerg.endrullis.de/assets/papers/streams-degrees-2011.pdf">Degrees of streams</a>.

%H S. Ferenczi, <a href="http://dx.doi.org/10.1016/S0012-365X(98)00400-2">Complexity of sequences and dynamical systems</a>, Discrete Math., 206 (1999), 145-154.

%H J. Grytczuk, <a href="http://dx.doi.org/10.1016/0012-365X(95)00297-A">Infinite semi-similar words</a>, Discrete Math. 161 (1996), 133-141.

%H A. Hof, O. Knill and B. Simon, <a href="http://projecteuclid.org/euclid.cmp/1104275098">Singular continuous spectrum for palindromic Schrödinger operators</a>, Commun. Math. Phys. 174 (1995), 149-159.

%H Clark Kimberling, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL3/goldentext.html">A Self-Generating Set and the Golden Mean</a>, J. Integer Sequences, 3 (2000), #00.2.8.

%H Clark Kimberling, <a href="https://doi.org/10.4171/EM/468">Intriguing infinite words composed of zeros and ones</a>, Elemente der Mathematik (2021).

%H M. Lothaire, <a href="http://www-igm.univ-mlv.fr/~berstel/Lothaire/">Algebraic Combinatorics on Words</a>, Cambridge, 2002, see p. 41, etc.

%H G. Melançon, <a href="http://dx.doi.org/10.1016/S0012-365X(99)00123-5">Lyndon factorization of sturmian words</a>, Discr. Math., 210 (2000), 137-149.

%H F. Mignosi, A. Restivo and M. Sciortino, <a href="http://dx.doi.org/10.1016/S0304-3975(00)00436-9">Words and forbidden factors</a>, WORDS (Rouen, 1999). Theoret. Comput. Sci. 273 (2002), no. 1-2, 99--117. MR1872445 (2002m:68096) - From _N. J. A. Sloane_, Jul 10 2012

%H F. Mignosi and L. Q. Zamboni, <a href="http://dx.doi.org/10.4064/aa101-2-4">On the number of Arnoux-Rauzy words</a>, Acta arith., 101 (2002), no. 2, 121-129.

%H T. D. Noe, <a href="/A003849/a003849.txt">The first 1652 subwords of A003849, including leading zeros.</a>

%H Giuseppe Pirillo, <a href="http://dx.doi.org/10.1016/S0012-365X(94)00236-C">Fibonacci numbers and words</a>, Discrete Math. 173 (1997), no. 1-3, 197--207. MR1468849 (98g:68135).

%H Patrice Séébold, <a href="http://www.numdam.org/item?id=ITA_2008__42_4_729_0">Look and Say Fibonacci</a>, RAIRO-Theor. Inf. Appl. 42 (2008) 729-746.

%H N. J. A. Sloane, <a href="/A003842/a003842.txt">The first 10946 terms, concatenated</a>

%H N. J. A. Sloane, <a href="/A115004/a115004.txt">Families of Essentially Identical Sequences</a>, Mar 24 2021 (Includes this sequence)

%H P. Steinbach, <a href="http://www.jstor.org/stable/2691048">Golden fields: a case for the heptagon</a>, Math. Mag. 70 (1997), no. 1, 22-31.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/GoldenRatio.html">Golden Ratio</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/L-system#Example_1:_Algae">L-system</a> Example 1: Algae

%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>

%F Define strings S(0)=2, S(1)=1, S(n)=S(n-1)S(n-2); iterate. Sequence is S(infinity).

%F a(n) = n + 2 - A120613(n+1). - _Benoit Cloitre_, Jul 28 2005 [Corrected by _N. J. A. Sloane_, Jun 30 2018]

%e Over the alphabet {a,b} this is the sequence a, b, a, a, b, a, b, a, a, b, a, a, b, a, b, a, a, b, a, b, a, a, b, a, a, b, a, b, a, a, b, a, a, b, a, b, a, a, b, a, b, a, a, b, a, a, b, a, b, a, a, b, a, b, a, a, b, a, a, b, a, b, a, a, b, a, a, b, a, b, a, a, b, a, b, a, a, b, a, a, b, a, b, a, a, b, a, a, b, a, b, a, a, b, a, b, a, a, b, a, a, b, a, b, a, ...

%t Nest[ Flatten[ # /. {1 -> {1, 2}, 2 -> {1}}] &, {1}, 10] (* _Robert G. Wilson v_, Mar 04 2005 *)

%t Table[n + 1 - Floor[((1 + Sqrt[5])/2)*Floor[2*(n + 1)/(1 + Sqrt[5])]], {n, 1, 50}] (* _G. C. Greubel_, May 18 2017 *)

%t SubstitutionSystem[{1->{1,2},2->{1}},{1},{10}][[1]] (* _Harvey P. Dale_, Nov 19 2022 *)

%o (Haskell)

%o a003842 n = a003842_list !! n

%o a003842_list = tail $ concat fws where

%o fws = [2] : [1] : (zipWith (++) fws $ tail fws)

%o -- _Reinhard Zumkeller_, Oct 26 2013

%o (PARI) for(n=1,50, print1(n+1 - floor(((1+sqrt(5))/2)*floor(2*(n+1)/(1+sqrt(5)))), ", ")) \\ _G. C. Greubel_, May 18 2017

%o (Python) def A003842(length):

%o a = [1]

%o while len(a)<length: a = [j for i in a for j in [[],[1,2],[1]][i]]

%o return a[:length] # _Nicholas Stefan Georgescu_, Jun 14 2022

%o (Python)

%o def aupto(nn):

%o S, Fnm2, Fnm1 = [1, 2], 1, 2

%o while len(S) < nn+1:

%o S += S[:min(Fnm2, nn+1-len(S))]

%o Fnm2, Fnm1 = Fnm1, Fnm1+Fnm2

%o return S

%o print(aupto(104)) # _Michael S. Branicky_, Jun 06 2022

%o (Python)

%o from math import isqrt

%o def A003842(n): return n+2-((m:=(n+2+isqrt(5*(n+2)**2)>>1)-n-2)+isqrt(5*m**2)>>1) # _Chai Wah Wu_, Aug 26 2022

%Y A003849 is another common version of this sequence.

%Y See also A014675, A005614, A001468, A106750, A213975, A213976, A214317, A214318, A182028, A120613.

%Y The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A000201 as the parent: A000201, A001030, A001468, A001950, A003622, A003842, A003849, A004641, A005614, A014675, A022342, A088462, A096270, A114986, A124841. - _N. J. A. Sloane_, Mar 11 2021

%K nonn,nice,easy

%O 0,2

%A _N. J. A. Sloane_

%E Entry revised by _N. J. A. Sloane_, Jul 03 2012