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.

Previous Showing 11-20 of 37 results. Next

A081290 a(0) = 0, and for n >=1, a(n) = the largest Catalan number <= n.

Original entry on oeis.org

0, 1, 2, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42
Offset: 0

Views

Author

Antti Karttunen, Mar 17 2003

Keywords

Comments

After n>0, A000108(n) occurs A000245(n) times.
For all n>0, a(A000108(n)) = A000108(n) [the first occurrence of the n-th Catalan number in this sequence].
Minimal i such that A081289(i) >= A081289(n) [the original definition of the sequence].
In other words, the first position k in A081289 where A081289(n) occurs (the minimal k such that A081289(k) = A081289(n)), and also the first position k in A081288 where A081288(n) occurs (the minimal k such that A081288(k) = A081288(n)). The starting point of the run which contains the n-th term in those sequences.

Crossrefs

Programs

  • Mathematica
    Join[{0},With[{catnos=Reverse[CatalanNumber[Range[10]]]},Table[ SelectFirst[ catnos,#<=n&],{n,80}]]] (* This program uses the SelectFirst function from Mathematica version 10 *) (* Harvey P. Dale, Jul 27 2014 *)

Formula

a(0) = 0, a(n) = A000108(A081288(n)-1).
Sum_{n>=1} 1/a(n)^2 = 44*Pi/sqrt(3) - 4*Pi^2 - 38. - Amiram Eldar, Aug 18 2022

Extensions

Name changed by Antti Karttunen, Apr 26 2014

A072660 Size of the parenthesizations obtained with the global ranking/unranking scheme A072656-A072659.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 3, 5, 4, 4, 4, 5, 4, 4, 6, 5, 5, 5, 5, 4, 6, 5, 4, 4, 5, 7, 6, 6, 6, 5, 5, 5, 6, 5, 5, 7, 6, 6, 6, 5, 4, 6, 5, 8, 7, 7, 7, 6, 7, 6, 6, 6, 6, 5, 7, 6, 5, 4, 6, 8, 7, 7, 7, 6, 6, 5, 7, 5, 5, 8, 6, 6, 9, 8, 8, 8, 7, 8, 7, 7, 9, 7, 7, 7, 6, 6, 5, 7, 5, 6, 8, 7, 7, 6, 6, 4, 7, 5, 9, 8
Offset: 0

Views

Author

Antti Karttunen, Jun 02 2002

Keywords

Crossrefs

Cf. A072657-A072659. Permutations: A071673, A072643, A072644, A072645.

A081288 a(n) is the minimal i such that A000108(i) > n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Mar 17 2003

Keywords

Comments

Apart from the initial term 0, each n occurs A000245(n-1) times.

Crossrefs

Cf. A000108, A000245, A072643, A081289, A081290. Used to compute A081291.

Programs

  • PARI
    A081288(n) = my(i=0); while(binomial(2*i, i)/(i+1) <= n, i++); i; \\ Michel Marcus, Apr 28 2020
  • Python
    from sympy import catalan
    def a(n):
        if n==0: return 0
        i=1
        while True:
            if catalan(i)>n: return i
            else: i+=1
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 08 2017
    

A072645 Size of the parenthesizations obtained with the global ranking/unranking scheme A072646/A072647.

Original entry on oeis.org

0, 1, 2, 3, 2, 4, 3, 3, 5, 3, 4, 4, 4, 7, 4, 4, 5, 3, 6, 5, 5, 9, 4, 5, 5, 5, 6, 4, 5, 7, 6, 6, 6, 5, 10, 5, 4, 5, 4, 5, 6, 6, 6, 4, 5, 6, 5, 8, 7, 7, 7, 6, 8, 6, 7, 11, 5, 6, 5, 6, 6, 5, 4, 6, 7, 6, 6, 6, 8, 5, 6, 7, 5, 7, 6, 6, 10, 8, 7, 7, 7, 7, 7, 8, 8, 7, 7, 8, 6, 12, 6, 5, 6, 4, 7, 7, 7, 8, 5, 6, 5, 6
Offset: 0

Views

Author

Antti Karttunen, Jun 02 2002

Keywords

Crossrefs

Each value v occurs A000108(v) times. The maximum position for value v to occur is A072654(v). Permutations: A071673, A072643, A072644, A072660.

A370220 Irregular triangle T(n,k) read by rows: row n lists the positions of left parentheses for the properly nested string of parentheses encoded by A063171(n).

Original entry on oeis.org

1, 1, 3, 1, 2, 1, 3, 5, 1, 3, 4, 1, 2, 5, 1, 2, 4, 1, 2, 3, 1, 3, 5, 7, 1, 3, 5, 6, 1, 3, 4, 7, 1, 3, 4, 6, 1, 3, 4, 5, 1, 2, 5, 7, 1, 2, 5, 6, 1, 2, 4, 7, 1, 2, 4, 6, 1, 2, 4, 5, 1, 2, 3, 7, 1, 2, 3, 6, 1, 2, 3, 5, 1, 2, 3, 4, 1, 3, 5, 7, 9, 1, 3, 5, 7, 8, 1, 3, 5, 6, 9
Offset: 1

Views

Author

Paolo Xausa, Feb 12 2024

Keywords

Comments

Knuth (2011) refers to these terms as z_k and notes that z_1, z_2, ..., z_m is one of the binomial(2*m,m) combinations of m >= 1 objects from the set {1, 2, ..., 2*m}, subject to the constraint that z_(k-1) < z_k < 2*k for 1 <= k <= m and assuming that z_0 = 0.

Examples

			The following table lists z_k values for properly nested strings having lengths up to 8, along with d_k, p_k and c_k values from related combinatorial objects (see related sequences for more information). Cf. Knuth (2011), p. 442, Table 1.
.
      | Properly |          | A370219 |         | A370221 | A370222
      | Nested   | A063171  | d d d d | z z z z | p p p p | c c c c
    n | String   |   (n)    | 1 2 3 4 | 1 2 3 4 | 1 2 3 4 | 1 2 3 4
  ----+----------+----------+---------+---------+---------+---------
    1 | ()       | 10       | 1       | 1       | 1       | 0
    2 | ()()     | 1010     | 1 1     | 1 3     | 1 2     | 0 0
    3 | (())     | 1100     | 0 2     | 1 2     | 2 1     | 0 1
    4 | ()()()   | 101010   | 1 1 1   | 1 3 5   | 1 2 3   | 0 0 0
    5 | ()(())   | 101100   | 1 0 2   | 1 3 4   | 1 3 2   | 0 0 1
    6 | (())()   | 110010   | 0 2 1   | 1 2 5   | 2 1 3   | 0 1 0
    7 | (()())   | 110100   | 0 1 2   | 1 2 4   | 2 3 1   | 0 1 1
    8 | ((()))   | 111000   | 0 0 3   | 1 2 3   | 3 2 1   | 0 1 2
    9 | ()()()() | 10101010 | 1 1 1 1 | 1 3 5 7 | 1 2 3 4 | 0 0 0 0
   10 | ()()(()) | 10101100 | 1 1 0 2 | 1 3 5 6 | 1 2 4 3 | 0 0 0 1
   11 | ()(())() | 10110010 | 1 0 2 1 | 1 3 4 7 | 1 3 2 4 | 0 0 1 0
   12 | ()(()()) | 10110100 | 1 0 1 2 | 1 3 4 6 | 1 3 4 2 | 0 0 1 1
   13 | ()((())) | 10111000 | 1 0 0 3 | 1 3 4 5 | 1 4 3 2 | 0 0 1 2
   14 | (())()() | 11001010 | 0 2 1 1 | 1 2 5 7 | 2 1 3 4 | 0 1 0 0
   15 | (())(()) | 11001100 | 0 2 0 2 | 1 2 5 6 | 2 1 4 3 | 0 1 0 1
   16 | (()())() | 11010010 | 0 1 2 1 | 1 2 4 7 | 2 3 1 4 | 0 1 1 0
   17 | (()()()) | 11010100 | 0 1 1 2 | 1 2 4 6 | 2 3 4 1 | 0 1 1 1
   18 | (()(())) | 11011000 | 0 1 0 3 | 1 2 4 5 | 2 4 3 1 | 0 1 1 2
   19 | ((()))() | 11100010 | 0 0 3 1 | 1 2 3 7 | 3 2 1 4 | 0 1 2 0
   20 | ((())()) | 11100100 | 0 0 2 2 | 1 2 3 6 | 3 2 4 1 | 0 1 2 1
   21 | ((()())) | 11101000 | 0 0 1 3 | 1 2 3 5 | 3 4 2 1 | 0 1 2 2
   22 | (((()))) | 11110000 | 0 0 0 4 | 1 2 3 4 | 4 3 2 1 | 0 1 2 3
		

References

  • Donald E. Knuth, The Art of Computer Programming, Vol. 4A: Combinatorial Algorithms, Part 1, Addison-Wesley, 2011, Section 7.2.1.6, pp. 440-444. See also exercise 2, p. 471 and p. 781.

Crossrefs

Cf. A000108, A063171, A072643 (row lengths).
Cf. A370219, A370221, A370222, A370290 (row sums), A371409 (right parentheses).

Programs

  • Mathematica
    zlist[m_] := With[{r = 2*Range[2, m]}, Reverse[Map[Join[{1}, #] &, Select[Subsets[Range[2, 2*m-1], {m-1}], Min[r-#] > 0 &]]]];
    Array[Delete[zlist[#], 0] &, 5]
    (* 2nd program: uses Algorithm Z from Knuth's TAOCP section 7.2.1.6, exercise 2 *)
    zlist[m_] := Block[{z = 2*Range[m] - 1, j},
        Reap[
        While[True,
            Sow[z];
            If[z[[m-1]] < z[[m]] - 1,
                z[[m]]--,
                j = m - 1; z[[m]] = 2*m - 1;
                While[j > 1 && z[[j-1]] == z[[j]] - 1, z[[j]] = 2*j - 1; j--];
                If[j == 1,Break[]];
                z[[j]]--]
        ]][[2]][[1]]];
    Join[{{1}}, Array[Delete[zlist[#], 0] &, 4, 2]]

Formula

T(n,k) = T(n,k+1) - A370219(n,k) - 1, for 1 <= k < A072643(n).

A370222 Irregular triangle T(n,k) read by rows: row n gives the inversion table (see comments) of the permutation encoded by row n of A370221.

Original entry on oeis.org

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

Views

Author

Paolo Xausa, Feb 12 2024

Keywords

Comments

Knuth (2011) uses the inversion table c_1, c_2, ..., c_k (defined so that exactly c_k elements to the right of k are less than k) to encode the permutation given by row n of A370221.
This way c_1 = 0 and 0 <= c_(k+1) <= c_k + 1 for 1 <= k < m, where m >= 1 is half the length of the corresponding properly nested string of parentheses (see example).
The concatenation of terms in each row from row n = 23714 to 82498 (corresponding to strings of length 22, excluding the last one) gives the A000108(11) - 1 = 58785 terms of the finite sequence A239903.

Examples

			The following table lists c_k values for properly nested strings having lengths up to 8, along with d_k, z_k and p_k values from related combinatorial objects (see related sequences for more information). Cf. Knuth (2011), p. 442, Table 1.
.
      | Properly |          | A370219 | A370220 | A370221 |
      | Nested   | A063171  | d d d d | z z z z | p p p p | c c c c
    n | String   |   (n)    | 1 2 3 4 | 1 2 3 4 | 1 2 3 4 | 1 2 3 4
  ----+----------+----------+---------+---------+---------+---------
    1 | ()       | 10       | 1       | 1       | 1       | 0
    2 | ()()     | 1010     | 1 1     | 1 3     | 1 2     | 0 0
    3 | (())     | 1100     | 0 2     | 1 2     | 2 1     | 0 1
    4 | ()()()   | 101010   | 1 1 1   | 1 3 5   | 1 2 3   | 0 0 0
    5 | ()(())   | 101100   | 1 0 2   | 1 3 4   | 1 3 2   | 0 0 1
    6 | (())()   | 110010   | 0 2 1   | 1 2 5   | 2 1 3   | 0 1 0
    7 | (()())   | 110100   | 0 1 2   | 1 2 4   | 2 3 1   | 0 1 1
    8 | ((()))   | 111000   | 0 0 3   | 1 2 3   | 3 2 1   | 0 1 2
    9 | ()()()() | 10101010 | 1 1 1 1 | 1 3 5 7 | 1 2 3 4 | 0 0 0 0
   10 | ()()(()) | 10101100 | 1 1 0 2 | 1 3 5 6 | 1 2 4 3 | 0 0 0 1
   11 | ()(())() | 10110010 | 1 0 2 1 | 1 3 4 7 | 1 3 2 4 | 0 0 1 0
   12 | ()(()()) | 10110100 | 1 0 1 2 | 1 3 4 6 | 1 3 4 2 | 0 0 1 1
   13 | ()((())) | 10111000 | 1 0 0 3 | 1 3 4 5 | 1 4 3 2 | 0 0 1 2
   14 | (())()() | 11001010 | 0 2 1 1 | 1 2 5 7 | 2 1 3 4 | 0 1 0 0
   15 | (())(()) | 11001100 | 0 2 0 2 | 1 2 5 6 | 2 1 4 3 | 0 1 0 1
   16 | (()())() | 11010010 | 0 1 2 1 | 1 2 4 7 | 2 3 1 4 | 0 1 1 0
   17 | (()()()) | 11010100 | 0 1 1 2 | 1 2 4 6 | 2 3 4 1 | 0 1 1 1
   18 | (()(())) | 11011000 | 0 1 0 3 | 1 2 4 5 | 2 4 3 1 | 0 1 1 2
   19 | ((()))() | 11100010 | 0 0 3 1 | 1 2 3 7 | 3 2 1 4 | 0 1 2 0
   20 | ((())()) | 11100100 | 0 0 2 2 | 1 2 3 6 | 3 2 4 1 | 0 1 2 1
   21 | ((()())) | 11101000 | 0 0 1 3 | 1 2 3 5 | 3 4 2 1 | 0 1 2 2
   22 | (((()))) | 11110000 | 0 0 0 4 | 1 2 3 4 | 4 3 2 1 | 0 1 2 3
		

References

  • Donald E. Knuth, The Art of Computer Programming, Vol. 4A: Combinatorial Algorithms, Part 1, Addison-Wesley, 2011, Section 7.2.1.6, pp. 440-444.

Crossrefs

Cf. A000108, A063171, A072643 (row lengths), A239903.
Cf. A370219, A370220, A370221, A370292 (row sums).

Programs

  • Mathematica
    clist[m_] := With[{r = 2*Range[2, m]-1}, Reverse[Map[Join[{0}, r-#] &, Select[Subsets[Range[2, 2*m-1], {m-1}], Min[r-#] >= 0 &]]]];
    Array[Delete[clist[#], 0] &, 5]
    (* 2nd program: uses Algorithm Z from Knuth's TAOCP section 7.2.1.6, exercise 2 *)
    zlist[m_] := Block[{z = 2*Range[m] - 1, j},
        Reap[
        While[True,
            Sow[z];
            If[z[[m-1]] < z[[m]] - 1,
                z[[m]]--,
                j = m - 1; z[[m]] = 2*m - 1;
                While[j > 1 && z[[j-1]] == z[[j]] - 1, z[[j]] = 2*j - 1; j--];
                If[j == 1,Break[]];
                z[[j]]--]
        ]][[2]][[1]]];
    Join[{{0}}, Table[Delete[Map[2*Range[n] - 1 - # &, zlist[n]], 0], {n, 2, 5}]] (* Paolo Xausa, Mar 25 2024 *)

Formula

T(n,k) = 2*k - 1 - A370220(n,k).

A106457 Number of edges in each rooted plane tree produced with the GF(2)[X] factorization unranking algorithm presented in A106456.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 4, 4, 3, 4, 5, 6, 5, 4, 5, 6, 4, 7, 6, 5, 5, 5, 5, 8, 4, 9, 5, 6, 6, 9, 7, 6, 5, 10, 5, 8, 6, 5, 7, 11, 5, 5, 8, 5, 7, 7, 6, 12, 5, 7, 6, 13, 6, 14, 9, 5, 4, 6, 10, 15, 6, 5, 7, 15, 6, 16, 10, 7, 8, 14, 7, 8, 6, 6, 11, 6, 6, 5, 9, 17, 6, 13, 6, 18, 8, 9, 12
Offset: 1

Views

Author

Antti Karttunen, May 09 2005

Keywords

Comments

Also the digital length of A106456(n)/2. Each value v occurs A000108(v) times.

Crossrefs

a(n) = A075167(A106443(n)). Permutation of A072643.

A153246 Number of fleeing trees computed for Catalan bijection A057164.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 22 2008

Keywords

Comments

A "fleeing tree" sequence computed for Catalan bijection CatBij gives for each binary tree A014486(n) the number of cases where, when a new V-node (a bud) is inserted into one of the A072643(n)+1 possible leaves of that tree, it follows that (CatBij tree) is not a subtree of (CatBij tree-with-bud-inserted). I.e., for each tree A014486(n), we compute Sum_{i=0}^A072643(n) (1 if catbij(n) is a subtree of catbij(A153250bi(n,i)), 0 otherwise). Here A153250 gives the bud-inserting operation. Note that for any Catalan Bijection, which is an image of "psi" isomorphism (see A153141) from the Automorphism Group of infinite binary trees, the result will be A000004, the zero-sequence. To satisfy that condition, CatBij should at least satisfy A127302(CatBij(n)) = A127302(n) for all n (clearly A057164 does not satisfy that, so we got nonzero terms here). However, that is just a necessary but not a sufficient condition. For example, A123493 & A123494 satisfy it, but they still produce nonzero sequences: A153247, A153248.

Crossrefs

A218786 The sizes of the "tendrils" (finite side-trees sprouting at A213730, A218787) of infinite beanstalk (A179016).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Nov 11 2012

Keywords

Examples

			The first four tendrils of the beanstalk sprout at 2, 5, 6 and 9, (the first four nonzero terms of A213730) which are all leaves (i.e., in A055938), thus the first four terms of this sequence are all 0's. The next term A213730(5)=10, which is not leaf, but branches to two leaf-branches (12 and 13, as with both we have: 12-A000120(12)=10 and 13-A000120(13)=10, and both 12 and 13 are found from A055938, so the tendril at 10 is a binary tree of one internal vertex (and two leaves), i.e., \/, thus a(5)=1.
		

Crossrefs

Equally, a(n) = A072643(A218787(n)) = A072643(A218788(n)). Cf. A218613, A218603, A218604.

Programs

Formula

a(n) = A213726(A213730(n))-1.

A370221 Irregular triangle T(n,k) read by rows: row n lists the values encoding a permutation (see comments) related to the properly nested string of parentheses encoded by A063171(n).

Original entry on oeis.org

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

Views

Author

Paolo Xausa, Feb 12 2024

Keywords

Comments

Knuth (2011) refers to these terms as p_k and defines them so that, in a properly nested string of parentheses, the k-th right parenthesis matches the p_k-th left parenthesis.
A370222 gives the corresponding values of a related inversion table.

Examples

			The following table lists p_k values for properly nested strings having lengths up to 8, along with d_k, z_k and c_k values from related combinatorial objects (see related sequences for more information). Cf. Knuth (2011), p. 442, Table 1.
.
      | Properly |          | A370219 | A370220 |         | A370222
      | Nested   | A063171  | d d d d | z z z z | p p p p | c c c c
    n | String   |   (n)    | 1 2 3 4 | 1 2 3 4 | 1 2 3 4 | 1 2 3 4
  ----+----------+----------+---------+---------+---------+---------
    1 | ()       | 10       | 1       | 1       | 1       | 0
    2 | ()()     | 1010     | 1 1     | 1 3     | 1 2     | 0 0
    3 | (())     | 1100     | 0 2     | 1 2     | 2 1     | 0 1
    4 | ()()()   | 101010   | 1 1 1   | 1 3 5   | 1 2 3   | 0 0 0
    5 | ()(())   | 101100   | 1 0 2   | 1 3 4   | 1 3 2   | 0 0 1
    6 | (())()   | 110010   | 0 2 1   | 1 2 5   | 2 1 3   | 0 1 0
    7 | (()())   | 110100   | 0 1 2   | 1 2 4   | 2 3 1   | 0 1 1
    8 | ((()))   | 111000   | 0 0 3   | 1 2 3   | 3 2 1   | 0 1 2
    9 | ()()()() | 10101010 | 1 1 1 1 | 1 3 5 7 | 1 2 3 4 | 0 0 0 0
   10 | ()()(()) | 10101100 | 1 1 0 2 | 1 3 5 6 | 1 2 4 3 | 0 0 0 1
   11 | ()(())() | 10110010 | 1 0 2 1 | 1 3 4 7 | 1 3 2 4 | 0 0 1 0
   12 | ()(()()) | 10110100 | 1 0 1 2 | 1 3 4 6 | 1 3 4 2 | 0 0 1 1
   13 | ()((())) | 10111000 | 1 0 0 3 | 1 3 4 5 | 1 4 3 2 | 0 0 1 2
   14 | (())()() | 11001010 | 0 2 1 1 | 1 2 5 7 | 2 1 3 4 | 0 1 0 0
   15 | (())(()) | 11001100 | 0 2 0 2 | 1 2 5 6 | 2 1 4 3 | 0 1 0 1
   16 | (()())() | 11010010 | 0 1 2 1 | 1 2 4 7 | 2 3 1 4 | 0 1 1 0
   17 | (()()()) | 11010100 | 0 1 1 2 | 1 2 4 6 | 2 3 4 1 | 0 1 1 1
   18 | (()(())) | 11011000 | 0 1 0 3 | 1 2 4 5 | 2 4 3 1 | 0 1 1 2
   19 | ((()))() | 11100010 | 0 0 3 1 | 1 2 3 7 | 3 2 1 4 | 0 1 2 0
   20 | ((())()) | 11100100 | 0 0 2 2 | 1 2 3 6 | 3 2 4 1 | 0 1 2 1
   21 | ((()())) | 11101000 | 0 0 1 3 | 1 2 3 5 | 3 4 2 1 | 0 1 2 2
   22 | (((()))) | 11110000 | 0 0 0 4 | 1 2 3 4 | 4 3 2 1 | 0 1 2 3
		

References

  • Donald E. Knuth, The Art of Computer Programming, Vol. 4A: Combinatorial Algorithms, Part 1, Addison-Wesley, 2011, Section 7.2.1.6, pp. 440-444.

Crossrefs

Cf. A000108, A063171, A072643 (row lengths).
Cf. A370219, A370220, A370222, A370291 (row sums).

Programs

  • Mathematica
    slist[m_] := Reverse[Select[Permutations[PadLeft[Table[-1, m], 2*m, 1]], Min[Accumulate[#]] >= 0 &]];
    plist[s_] := Flatten[Reap[Module[{p, p0 = Flatten[Position[s, -1]], p1 = Flatten[Position[s, 1]], p1r}, p1r = p1; For[i = 1, i <= Length[p0], i++, p = Max[Select[p1r, # < p0[[i]] &]]; Sow[Position[p1, p]]; p1r = DeleteCases[p1r, p]]]][[2,1]]];
    Array[Delete[Map[plist, slist[#]], 0] &, 5]
Previous Showing 11-20 of 37 results. Next