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-5 of 5 results.

A092782 The ternary tribonacci word; also a Rauzy fractal sequence: fixed point of the morphism 1 -> 12, 2 -> 13, 3 -> 1, starting from a(1) = 1.

Original entry on oeis.org

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

Views

Author

Philippe Deléham, Apr 23 2004

Keywords

Comments

See A080843 for the {0,1,2} version, which in a sense is the most basic version.
See also A103269 for another version with further references and comments.
Also called a tribonacci word. In the limit the ratios #1's : #2's : #3's are t^2 : t : 1 where t is the tribonacci constant 1.839286755... (A058265). - Frank M Jackson, Mar 29 2018
a(n)-1 is the number of trailing 0's in the maximal tribonacci representation of n (A352103). - Amiram Eldar, Feb 29 2024

Examples

			From _Joerg Arndt_, Sep 14 2013: (Start)
The first few steps of the substitution are
Start: 1
Maps:
  1 --> 12
  2 --> 13
  3 --> 1
-------------
0:   (#=1)
  1
1:   (#=2)
  12
2:   (#=4)
  1213
3:   (#=7)
  1213121
4:   (#=13)
  1213121121312
5:   (#=24)
  121312112131212131211213
6:   (#=44)
  12131211213121213121121312131211213121213121
7:   (#=81)
  121312112131212131211213121312112131212131211213121121312121312112131213121121312
(End)
		

References

  • This entry has a fairly complete list of references and links concerning the ternary tribonacci word. - N. J. A. Sloane, Aug 17 2018
  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 246.
  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.

Crossrefs

See A080843 for a {0,1,2} version.
First differences: A317950.

Programs

  • Maple
    f(1):= (1, 2): f(2):= (1, 3): f(3):= (1): A:= [1]:
    for i from 1 to 16 do A:= map(f, A) od:
    A; # 19513 terms of A092782; A103269; from N. J. A. Sloane, Aug 06 2018
  • Mathematica
    Nest[ Flatten[# /. {1 -> {1, 2}, 2 -> {1, 3}, 3 -> 1}] &, {1}, 8] (* Robert G. Wilson v, Mar 04 2005 and updated Apr 29 2018 *)
  • PARI
    w=vector(9,x,[]); w[1]=[1];
    for(n=2,9,for(k=1,#w[n-1],m=w[n-1][k];v=[];if(m-1,if(m-2,v=[1],v=[1,3]),v=[1,2]);w[n]=concat(w[n],v)));
    w[9] \\ Gerald McGarvey, Dec 18 2009
    
  • PARI
    strsub(s, vv, off=0)=
    {
        my( nl=#vv, r=[], ct=1 );
        while ( ct <= #s,
            r = concat(r, vv[ s[ct] + (1-off) ] );
            ct += 1;
        );
        return( r );
    }
    t=[1];  for (k=1, 10, t=strsub( t, [[1,2], [1,3], [1]], 1 ) );  t
    \\ Joerg Arndt, Sep 14 2013
    
  • PARI
    A092782_vec(N,s=[[1,2],[1,3],1],A=[1])={while(#AM. F. Hasler, Dec 14 2018

Formula

a(n) = 1 for n in A003144; a(n) = 2 for n in A003145; a(n) = 3 for n in A003146.
a(n) = A080843(n-1) + 1. - Joerg Arndt, Sep 14 2013

Extensions

Additional references and links added by N. J. A. Sloane, Aug 17 2018

A073058 Define s(1)={1,2}, s(2)={1,3} and s(3)={1}. For a finite sequence A={a_1, ..., a_n}, with elements in {1,2,3}, define t(A) to be the concatenation of A, s(a_1), s(a_2), ... and s(a_n). Start with the sequence {1,2,3} and repeatedly apply t; limiting sequence is shown.

Original entry on oeis.org

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

Views

Author

Roger L. Bagula, Aug 16 2002

Keywords

Comments

A fractal sequence related to a sequence of Rauzy.

Crossrefs

Programs

  • Mathematica
    Nest[ Flatten[ Join[#, # /. {1 -> {1, 2}, 2 -> {1, 3}, 3 -> {1}}]] &, {1, 2, 3},
    4] (* Robert G. Wilson v, Jan 01 2017 *)

A105083 Trajectory of 1 under the morphism 1 -> 12, 2 -> 3, 3 -> 1.

Original entry on oeis.org

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

Views

Author

Roger L. Bagula, Apr 06 2005

Keywords

Crossrefs

Programs

  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {1 -> {1, 2}, 2 -> {3}, 3 -> {1}})] }], {1}, 12]
  • Python
    N_TERMS=10000
    def a():
      # Index of the current term
      n = 0
      # Stores the place values of the greedy representation of n,
      # minus two since A000930 begins with duplicate ones.
      places = []
      # Edge case: a(0)=1.
      yield 0, 1
      while True:
        n += 1
        # Add A000930(2+0)=1 to the representation of n
        places.append(0)
        # Apply carryover rule for as long as necessary:
        # if places contains n+2 and n,
        # both terms are replaced by n+3.
        while len(places) > 1 and places[-2] <= places[-1]+2:
          places.pop()
          places[-1] += 1
        # Look at the smallest term to decide a(n)
        an = 1 if places[-1] > 1 else places[-1]+2
        yield n, an
    # Asymptotic behavior is O(log(n)*log(log(n))) memory
    # and O(n) time to generate the first n terms,
    # although a term may take as long as O(log(n)).
    for n, an in a():
      print(n, an)
      if (n >= N_TERMS):
        break
    # Aresh Pourkavoos, Jan 26 2021

Formula

From Aresh Pourkavoos, Jan 26 2021: (Start)
Limit S(infinity) of the following strings: S(0) = 2, S(1) = 1, S(2) = 0, S(n+3) = S(n+2)S(n). S(n) has length A000930(n).
Individual terms of a(n) may also be found by greedily writing n as a sum of entries of A000930. a(n) is 2 if the smallest term is 1, 3 if the smallest term is 2, and 1 otherwise.
(End)
a(n) = A005374(n+1) - A005374(n) - 2*(A202340(n+1) - 2). - Alan Michael Gómez Calderón, Jul 19 2025

Extensions

Edited by N. J. A. Sloane, Oct 10 2007 and Aug 03 2014

A245554 A Rauzy fractal sequence: trajectory of 1 under morphism 1 -> 1,2,1,3; 2 -> 3; 3 -> 1.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Aug 03 2014

Keywords

Crossrefs

Programs

  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {1 -> {1, 2, 1, 3}, 2 -> {3}, 3 -> {1}})] }], {1}, 9]

A245555 Trajectory of 1 under the morphism 1 -> 12, 2 -> 23, 3 -> 31.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Aug 03 2014

Keywords

Comments

The morphism 1->12, 2->21 gives the {1,2} version of the Thue-Morse sequence A001285, cf. A010060.
The morphism 0->01, 1->12, 2->20 gives the generalized Thue-Morse sequence A071858.

Crossrefs

Essentially the same as A071858.

Programs

  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {1 -> {1, 2}, 2 -> {2, 3}, 3 -> {3, 1}})] }], {1}, 9]
  • PARI
    {a(n) = my(v = [1]); if( n<1, 0, while( #vMichael Somos, Aug 05 2014 */

Formula

a(n) = A071858(n+1) + 1. - Michel Dekking, Sep 29 2020
Showing 1-5 of 5 results.