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-10 of 25 results. Next

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

A103684 Triangle read by rows, based on the morphism f: 1->{1,2}, 2->{1,3}, 3->{1}. First row is 1. If current row is a,b,c,..., then the next row is a,b,c,...,f(a),f(b),f(c),...

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 1, 2, 1, 2, 1, 3, 1, 2, 1, 3, 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, 1, 2, 1, 3, 1
Offset: 1

Views

Author

Roger L. Bagula, Mar 26 2005

Keywords

Examples

			[1], [1,1,2], [1,1,2,1,2,1,2,1,3], [1,1,2,1,2,1,2,1,3,1,2,1,2,1,3,1,2,1,3,1,2,1,3,1,2,1], ...
		

Crossrefs

Programs

  • Mathematica
    NestList[ Flatten[ Join[ #, # /. {1 -> {1, 2}, 2 -> {1, 3}, 3->{1}}]] &, {1}, 4] // Flatten (* Robert G. Wilson v, Jul 09 2006 - corrected by G. C. Greubel, Oct 26 2017 *)
  • PARI
    {a(n)=local(m,v,w); v=w=[1]; while(length(w)Michael Somos, Apr 16 2005 */

Extensions

Image of {3} in the definition corrected by R. J. Mathar, Nov 18 2010

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

A103685 Consider the morphism 1->{1,2}, 2->{1,3}, 3->{1}; a(n) is the total number of '3' after n substitutions.

Original entry on oeis.org

0, 0, 1, 5, 17, 51, 147, 419, 1191, 3383, 9607, 27279, 77455, 219919, 624415, 1772895, 5033759, 14292287, 40579903, 115217983, 327136895, 928835455, 2637230207, 7487852799, 21260161279, 60363694335, 171389837823, 486624896511, 1381667623423, 3922950583295
Offset: 0

Views

Author

Roger L. Bagula, Mar 26 2005

Keywords

Comments

Examples of the morphism starting with {1} are shown in A103684. Counting the total number of '1' in rows 1 to n of A103684 yields 1, 3, 8,... = A073357(n+1),
counting the total number of '2' in rows 1 to n yields 0, 1, 4,.. = A115390(n+1),
and counting the total number '3' in rows 1 to n yields a(n), the sequence here.
Inverse binomial transform yields 0, 0, 1, 2, 3, 6, 11, 20,..., a variant of A001590 [Nov 18 2010]

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{5,-8,6,-2},{0,0,1,5},30] (* Harvey P. Dale, Nov 10 2011 *)

Formula

a(n)= +5*a(n-1) -8*a(n-2) +6*a(n-3) -2*a(n-4) = a(n-1)+A115390(n). [Nov 18 2010]
G.f.: x^2 / ( (x-1)*(2*x^3-4*x^2+4*x-1) ). [Nov 18 2010]

Extensions

Depleted by the information already in A073357 and A115390; corrected image of {2} in the defn. - The Assoc. Eds. of the OEIS, Nov 18 2010

A105111 Triangle read by rows, based on the morphism f: 1->2, 2->3, 3->{3,5,4}, 4->5, 5->6, 6->{6,2,1}. First row is 1. If current row is a,b,c,..., then the next row is a,b,c,...,f(a),f(b),f(c),...

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 3, 5, 4, 1, 2, 2, 3, 2, 3, 3, 3, 5, 4, 2, 3, 3, 3, 5, 4, 3, 3, 5, 4, 3, 5, 4, 3, 5, 4, 6, 5, 1, 2, 2, 3, 2, 3, 3, 3, 5, 4, 2, 3, 3, 3, 5, 4, 3, 3, 5, 4, 3, 5, 4, 3, 5, 4, 6, 5, 2, 3, 3, 3, 5, 4, 3, 3, 5, 4, 3, 5, 4, 3, 5, 4, 6, 5, 3, 3, 5, 4, 3, 5, 4, 3, 5, 4, 6, 5, 3, 5
Offset: 0

Views

Author

Roger L. Bagula, Apr 07 2005

Keywords

Comments

6-symbol substitution based on the second type Rauzy substitution that gives a tile in the Kenyon boundary method.

Crossrefs

Programs

  • Mathematica
    s[n_] := n /. {1 -> 2, 2 -> 3, 3 -> {3, 5, 4}, 4 -> 5, 5 -> 6, 6 -> {6, 2, 1}}; t[a_] := Join[a, Flatten[s /@ a]]; Flatten[ NestList[t, {1}, 5]]

A105202 Irregular triangle read by rows: row n gives the word f(f(f(...(1)))) [with n applications of f], where f is the morphism 1->{1,2,1}, 2->{2,3,2}, 3->{3,1,3}.

Original entry on oeis.org

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

Views

Author

Roger L. Bagula, Apr 09 2005

Keywords

Comments

Row n contains 3^n symbols.

Examples

			From _Antti Karttunen_, Aug 12 2017: (Start)
The rows 0 .. 3 of this irregular triangle:
  1
  1;2;1
  1 2 1;2 3 2;1 2 1;
  1 2 1 2 3 2 1 2 1;2 3 2 3 1 3 2 3 2;1 2 1 2 3 2 1 2 1
(End)
		

Crossrefs

Each row is a prefix of A105203.

Programs

  • Mathematica
    f[n_] := Nest[ Flatten[ # /. {1 -> {1, 2, 1}, 2 -> {2, 3, 2}, 3 -> {3, 1, 3}}] &, {1}, n]; Flatten[ Table[ f[n], {n, 0, 4}]] (* Robert G. Wilson v, Apr 12 2005 *)

Formula

Let r = A062153(1+(2*n)) [index of the row], let c = n - A003462(r) [index of the column], then a(n) = 1 + (a(A003462(r-1)+floor(c/3)) mod 3) if n ≡ 2 mod 3, otherwise a(n) = a(A003462(r-1)+floor(c/3)). - Antti Karttunen, Aug 12 2017

Extensions

More terms from Robert G. Wilson v, Apr 12 2005

A105203 Trajectory of 1 under the morphism f: 1->{1,2,1}, 2->{2,3,2}, 3->{3,1,3}.

Original entry on oeis.org

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

Views

Author

Roger L. Bagula, Apr 09 2005

Keywords

Crossrefs

Programs

Formula

a(0) = 1; and for n > 1, a(n) = A105202(n+A003462(1+A062153(n))). - Antti Karttunen, Aug 12 2017

Extensions

More terms from Robert G. Wilson v, Apr 12 2005

A073057 Start with the word 1234, repeatedly append the words obtained via the maps 1 -> 12, 2 -> 13, 3 -> 42, 4 -> 43.

Original entry on oeis.org

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

Views

Author

Roger L. Bagula, Aug 16 2002

Keywords

Comments

Fixed point of the morphism 1 -> 12, 2 -> 13, 3 -> 42, 4 ->43, starting from a(1-4) = 1234. - Robert G. Wilson v, Apr 02 2009 [not quite correct, see name, Joerg Arndt, Feb 27 2018]

Examples

			The first step takes {1,2,3,4} to {1,2,3,4, 1,2, 1,3, 4,2, 4,3}.
The next takes this to {1,2,3,4,1,2,1,3,4,2,4,3, 1,2, 1,3, 4,2, 4,3, 1,2, 1,3, 1,2, 4,2, 4,3, 1,3, 4,3, 4,2}
		

Crossrefs

Cf. A100260 (morphism as 0..3).

Programs

  • Mathematica
    Nest[ Flatten[ Join[ #, # /. {1 -> {1, 2}, 2 -> {1, 3}, 3 -> {4, 2}, 4 -> {4, 3}}]] &, {1, 2, 3, 4}, 3] (* Robert G. Wilson v, Apr 02 2009 *)
  • PARI
    \\ See links.

Extensions

New name using a (corrected) comment by Robert G. Wilson from Joerg Arndt, Feb 27 2018

A103748 Triangle read by rows, based on the morphism f: 1->{2}, 2->{3}, 3->{3,3,2,1}. First row is 1. If current row is a,b,c,..., then the next row is a,b,c,...,f(a),f(b),f(c),...

Original entry on oeis.org

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

Views

Author

Roger L. Bagula, Mar 28 2005

Keywords

Comments

Kenyon tile substitution sequence.

Crossrefs

Programs

  • Mathematica
    s[n_] := n /. {1 -> 2, 2 -> 3, 3 -> {3, 3, 2, 1}}; t[a_] := Join[a, Flatten[s /@ a]]; Flatten[ NestList[t, {1}, 5]]

A105141 Triangle read by rows, based on the morphism f: 1->{1,2,1}, 2->{2,3,2}, 3->{3,1,3}. First row is 1. If current row is a,b,c,..., then the next row is a,b,c,...,f(a),f(b),f(c),...

Original entry on oeis.org

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

Views

Author

Roger L. Bagula, Apr 09 2005

Keywords

Comments

3-symbol substitution tile called both ter dragon and fudge flake. This tile is the classic cyclotomic n=3.
Row n contains (3^(n+1)-1)/2 symbols.

Crossrefs

Programs

  • Mathematica
    s[n_] := n /. {1 -> {1, 2, 1}, 2 -> {2, 3, 2}, 3 -> {3, 1, 3}}; t[a_] := Join[a, Flatten[s /@ a]]; Flatten[ NestList[t, {1}, 4]]
Showing 1-10 of 25 results. Next