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.

Showing 1-3 of 3 results.

A003842 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).

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Keywords

Comments

Or, fixed point of the morphism 1->12, 2->1, starting from a(1) = 2.
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).
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
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
In the limit #1's : #2's = phi : 1. - Frank M Jackson, Mar 12 2018

Examples

			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, ...
		

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003.
  • Jean Berstel, "Fibonacci words—a survey." In The book of L, pp. 13-27. Springer Berlin Heidelberg, 1986.
  • J. Berstel and J. Karhumaki, Combinatorics on words - a tutorial, Bull. EATCS, #79 (2003), pp. 178-228.
  • 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.
  • 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.
  • 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.
  • G. Melançon, Factorizing infinite words using Maple, MapleTech journal, vol. 4, no. 1, 1997, pp. 34-42, esp. p. 36.

Crossrefs

A003849 is another common version of this sequence.
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

Programs

  • Haskell
    a003842 n = a003842_list !! n
    a003842_list = tail $ concat fws where
       fws = [2] : [1] : (zipWith (++) fws $ tail fws)
    -- Reinhard Zumkeller, Oct 26 2013
    
  • Mathematica
    Nest[ Flatten[ # /. {1 -> {1, 2}, 2 -> {1}}] &, {1}, 10] (* Robert G. Wilson v, Mar 04 2005 *)
    Table[n + 1 - Floor[((1 + Sqrt[5])/2)*Floor[2*(n + 1)/(1 + Sqrt[5])]], {n, 1, 50}] (* G. C. Greubel, May 18 2017 *)
    SubstitutionSystem[{1->{1,2},2->{1}},{1},{10}][[1]] (* Harvey P. Dale, Nov 19 2022 *)
  • 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
    
  • Python
    def A003842(length):
        a = [1]
        while len(a)Nicholas Stefan Georgescu, Jun 14 2022
    
  • Python
    def aupto(nn):
        S, Fnm2, Fnm1 = [1, 2], 1, 2
        while len(S) < nn+1:
            S += S[:min(Fnm2, nn+1-len(S))]
            Fnm2, Fnm1 = Fnm1, Fnm1+Fnm2
        return S
    print(aupto(104)) # Michael S. Branicky, Jun 06 2022
    
  • Python
    from math import isqrt
    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

Formula

Define strings S(0)=2, S(1)=1, S(n)=S(n-1)S(n-2); iterate. Sequence is S(infinity).
a(n) = n + 2 - A120613(n+1). - Benoit Cloitre, Jul 28 2005 [Corrected by N. J. A. Sloane, Jun 30 2018]

Extensions

Entry revised by N. J. A. Sloane, Jul 03 2012

A182028 Take first n bits of the infinite Fibonacci word A003849, regard them as a binary number, then convert it to base 10.

Original entry on oeis.org

0, 1, 2, 4, 9, 18, 37, 74, 148, 297, 594, 1188, 2377, 4754, 9509, 19018, 38036, 76073, 152146, 304293, 608586, 1217172, 2434345, 4868690, 9737380, 19474761, 38949522, 77899045, 155798090, 311596180, 623192361, 1246384722, 2492769444, 4985538889, 9971077778
Offset: 0

Views

Author

Reinhard Zumkeller, Apr 07 2012

Keywords

Comments

a(n) mod 2 = A003849(n);
a(n) = A000225(n+1) - A044432(n).

Examples

			0 ->                            0 -> a(0) = 0,
0,1 ->                         01 -> a(1) = 1,
0,1,0 ->                      010 -> a(2) = 2,
0,1,0,0 ->                   0100 -> a(3) = 4,
0,1,0,0,1 ->                01001 -> a(4) = 9,
0,1,0,0,1,0 ->             010010 -> a(5) = 18,
0,1,0,0,1,0,1 ->          0100101 -> a(6) = 37
0,1,0,0,1,0,1,0 ->       01001010 -> a(7) = 74
0,1,0,0,1,0,1,0,0 ->    010010100 -> a(8) = 148,
0,1,0,0,1,0,1,0,0,1 -> 0100101001 -> a(9) = 297.
		

Crossrefs

Programs

  • Haskell
    a182028 n = a182028_list !! n
    a182028_list = scanl1 (\v b -> 2 * v + b) a003849_list
  • Mathematica
    nesting = 7; A003849 = Flatten[Nest[{#, #[[1]]}&, {0, 1}, nesting]]; a[n_] := FromDigits[Take[A003849, n+1], 2]; Table[a[n], {n, 0, Length[A003849] - 1}] (* Jean-François Alcover, Feb 13 2016 *)

Formula

a(n) = 2*a(n-1) + A003849(n) for n > 0, a(0) = 0.

A214317 a(n) = length-n prefix of the Fibonacci word A003842.

Original entry on oeis.org

1, 12, 121, 1211, 12112, 121121, 1211212, 12112121, 121121211, 1211212112, 12112121121, 121121211211, 1211212112112, 12112121121121, 121121211211212, 1211212112112121, 12112121121121211, 121121211211212112, 1211212112112121121, 12112121121121211212
Offset: 1

Views

Author

N. J. A. Sloane, Jul 12 2012

Keywords

Crossrefs

Programs

  • Maple
    S:= proc(n) option remember;
          `if`(n<2, [2-n], [S(n-1)[], S(n-2)[]])
        end:
    a:= proc(n) local k;
          for k while nops(S(k))Alois P. Heinz, Jul 19 2012
  • Mathematica
    S = SubstitutionSystem[{1 -> {1, 2}, 2 -> {1}}, {1}, 20];
    FromDigits[Take[#[[1]], #[[2]]]]& /@ Transpose[{S, Range[Length[S]]}] (* Jean-François Alcover, Nov 07 2020 *)
Showing 1-3 of 3 results.