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 117 results. Next

A238279 Triangle read by rows: T(n,k) is the number of compositions of n into nonzero parts with k parts directly followed by a different part, n>=0, 0<=k<=A004523(n-1).

Original entry on oeis.org

1, 1, 2, 2, 2, 3, 4, 1, 2, 10, 4, 4, 12, 14, 2, 2, 22, 29, 10, 1, 4, 26, 56, 36, 6, 3, 34, 100, 86, 31, 2, 4, 44, 148, 200, 99, 16, 1, 2, 54, 230, 374, 278, 78, 8, 6, 58, 322, 680, 654, 274, 52, 2, 2, 74, 446, 1122, 1390, 814, 225, 22, 1, 4, 88, 573, 1796, 2714, 2058, 813, 136, 10, 4, 88, 778, 2694, 4927
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 22 2014

Keywords

Comments

Same as A238130, with zeros omitted.
Last elements in rows are 1, 1, 2, 2, 1, 4, 2, 1, 6, 2, 1, 8, ... with g.f. -(x^6+x^4-2*x^2-x-1)/(x^6-2*x^3+1).
For n > 0, also the number of compositions of n with k + 1 runs. - Gus Wiseman, Apr 10 2020

Examples

			Triangle starts:
  00:  1;
  01:  1;
  02:  2;
  03:  2,   2;
  04:  3,   4,   1;
  05:  2,  10,   4;
  06:  4,  12,  14,    2;
  07:  2,  22,  29,   10,    1;
  08:  4,  26,  56,   36,    6;
  09:  3,  34, 100,   86,   31,    2;
  10:  4,  44, 148,  200,   99,   16,    1;
  11:  2,  54, 230,  374,  278,   78,    8;
  12:  6,  58, 322,  680,  654,  274,   52,    2;
  13:  2,  74, 446, 1122, 1390,  814,  225,   22,   1;
  14:  4,  88, 573, 1796, 2714, 2058,  813,  136,  10;
  15:  4,  88, 778, 2694, 4927, 4752, 2444,  618,  77,  2;
  16:  5, 110, 953, 3954, 8531, 9930, 6563, 2278, 415, 28, 1;
  ...
Row n=5 is 2, 10, 4 because in the 16 compositions of 5
  ##:  [composition]  no. of changes
  01:  [ 1 1 1 1 1 ]   0
  02:  [ 1 1 1 2 ]   1
  03:  [ 1 1 2 1 ]   2
  04:  [ 1 1 3 ]   1
  05:  [ 1 2 1 1 ]   2
  06:  [ 1 2 2 ]   1
  07:  [ 1 3 1 ]   2
  08:  [ 1 4 ]   1
  09:  [ 2 1 1 1 ]   1
  10:  [ 2 1 2 ]   2
  11:  [ 2 2 1 ]   1
  12:  [ 2 3 ]   1
  13:  [ 3 1 1 ]   1
  14:  [ 3 2 ]   1
  15:  [ 4 1 ]   1
  16:  [ 5 ]   0
there are 2 with no changes, 10 with one change, and 4 with two changes.
		

Crossrefs

Columns k=0-10 give: A000005 (for n>0), 2*A002133, A244714, A244715, A244716, A244717, A244718, A244719, A244720, A244721, A244722.
Row lengths are A004523.
Row sums are A011782.
The version counting adjacent equal parts is A106356.
The version for ascents/descents is A238343.
The version for weak ascents/descents is A333213.
The k-th composition in standard-order has A124762(k) adjacent equal parts, A124767(k) maximal runs, A333382(k) adjacent unequal parts, and A333381(k) maximal anti-runs.

Programs

  • Maple
    b:= proc(n, v) option remember; `if`(n=0, 1, expand(
          add(b(n-i, i)*`if`(v=0 or v=i, 1, x), i=1..n)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)):
    seq(T(n), n=0..14);
  • Mathematica
    b[n_, v_] := b[n, v] = If[n == 0, 1, Expand[Sum[b[n-i, i]*If[v == 0 || v == i, 1, x], {i, 1, n}]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0]]; Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Feb 11 2015, after Maple *)
    Table[If[n==0,1,Length[Select[Join@@Permutations/@IntegerPartitions[n],Length[Split[#]]==k+1&]]],{n,0,12},{k,0,If[n==0,0,Floor[2*(n-1)/3]]}] (* Gus Wiseman, Apr 10 2020 *)
  • PARI
    T_xy(max_row) = {my(N=max_row+1, x='x+O('x^N),h=(1+ sum(i=1,N,(x^i-y*x^i)/(1+y*x^i-x^i)))/(1-sum(i=1,N, y*x^i/(1+y*x^i-x^i)))); for(n=0,N-1, print(Vecrev(polcoeff(h,n))))}
    T_xy(16) \\ John Tyler Rascoe, Jul 10 2024

Formula

G.f.: A(x,y) = ( 1 + Sum_{i>0} ((x^i)*(1 - y)/(1 + y*x^i - x^i)) )/( 1 - Sum_{i>0} ((y*x^i)/(1 + y*x^i - x^i)) ). - John Tyler Rascoe, Jul 10 2024

A106356 Triangle T(n,k) 0<=k

Original entry on oeis.org

1, 1, 1, 3, 0, 1, 4, 3, 0, 1, 7, 6, 2, 0, 1, 14, 7, 8, 2, 0, 1, 23, 20, 10, 8, 2, 0, 1, 39, 42, 22, 13, 9, 2, 0, 1, 71, 72, 58, 28, 14, 10, 2, 0, 1, 124, 141, 112, 72, 33, 16, 11, 2, 0, 1, 214, 280, 219, 150, 92, 36, 18, 12, 2, 0, 1, 378, 516, 466, 311, 189, 112, 40, 20, 13, 2, 0, 1
Offset: 1

Views

Author

Christian G. Bower, Apr 29 2005

Keywords

Comments

For n > 0, also the number of compositions of n with k + 1 maximal anti-runs (sequences without adjacent equal terms). - Gus Wiseman, Mar 23 2020

Examples

			T(4,1) = 3 because the compositions of 4 with 1 adjacent equal part are 1+1+2, 2+1+1, 2+2.
Triangle begins:
   1;
   1,  1;
   3,  0,  1;
   4,  3,  0, 1;
   7,  6,  2, 0, 1;
  14,  7,  8, 2, 0, 1;
  23, 20, 10, 8, 2, 0, 1;
  ...
From _Gus Wiseman_, Mar 23 2020 (Start)
Row n = 6 counts the following compositions (empty column shown by dot):
  (6)     (33)    (222)    (11112)  .  (111111)
  (15)    (114)   (1113)   (21111)
  (24)    (411)   (1122)
  (42)    (1131)  (2211)
  (51)    (1221)  (3111)
  (123)   (1311)  (11121)
  (132)   (2112)  (11211)
  (141)           (12111)
  (213)
  (231)
  (312)
  (321)
  (1212)
  (2121)
(End)
		

Crossrefs

Row sums: 2^(n-1)=A000079(n-1). Columns 0-4: A003242, A106357-A106360.
The version counting adjacent unequal parts is A238279.
The k-th composition in standard-order has A124762(k) adjacent equal parts and A333382(k) adjacent unequal parts.
The k-th composition in standard-order has A124767(k) maximal runs and A333381(k) maximal anti-runs.
The version for ascents/descents is A238343.
The version for weak ascents/descents is A333213.

Programs

  • Maple
    b:= proc(n, h, t) option remember;
          if n=0 then `if`(t=0, 1, 0)
        elif t<0 then 0
        else add(b(n-j, j, `if`(j=h, t-1, t)), j=1..n)
          fi
        end:
    T:= (n, k)-> b(n, -1, k):
    seq(seq(T(n, k), k=0..n-1), n=1..15); # Alois P. Heinz, Oct 23 2011
  • Mathematica
    b[n_, h_, t_] := b[n, h, t] = If[n == 0, If[t == 0, 1, 0], If[t<0, 0, Sum[b[n-j, j, If [j == h, t-1, t]], {j, 1, n}]]]; T[n_, k_] := b[n, -1, k]; Table[Table[T[n, k], {k, 0, n-1}], {n, 1, 15}] // Flatten (* Jean-François Alcover, Feb 20 2015, after Alois P. Heinz *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],n==0||Length[Split[#,#1!=#2&]]==k+1&]],{n,0,12},{k,0,n}] (* Gus Wiseman, Mar 23 2020 *)

A333755 Triangle read by rows where T(n,k) is the number of compositions of n with k runs, n >= 0, 0 <= k <= n.

Original entry on oeis.org

1, 0, 1, 0, 2, 0, 0, 2, 2, 0, 0, 3, 4, 1, 0, 0, 2, 10, 4, 0, 0, 0, 4, 12, 14, 2, 0, 0, 0, 2, 22, 29, 10, 1, 0, 0, 0, 4, 26, 56, 36, 6, 0, 0, 0, 0, 3, 34, 100, 86, 31, 2, 0, 0, 0, 0, 4, 44, 148, 200, 99, 16, 1, 0, 0, 0, 0, 2, 54, 230, 374, 278, 78, 8, 0, 0, 0, 0
Offset: 0

Views

Author

Gus Wiseman, Apr 10 2020

Keywords

Comments

Except for a(1) = 0, the data is identical to A238130 shifted right once. However, in A238130, each row after the first ends with a zero, while here each row after the first starts with a zero.

Examples

			Triangle begins:
   1
   0   1
   0   2   0
   0   2   2   0
   0   3   4   1   0
   0   2  10   4   0   0
   0   4  12  14   2   0   0
   0   2  22  29  10   1   0   0
   0   4  26  56  36   6   0   0   0
   0   3  34 100  86  31   2   0   0   0
   0   4  44 148 200  99  16   1   0   0   0
   0   2  54 230 374 278  78   8   0   0   0   0
Row n = 6 counts the following compositions (empty column indicated by dot):
  .  (6)       (15)     (123)    (1212)
     (33)      (24)     (132)    (2121)
     (222)     (42)     (141)
     (111111)  (51)     (213)
               (114)    (231)
               (411)    (312)
               (1113)   (321)
               (1122)   (1131)
               (2211)   (1221)
               (3111)   (1311)
               (11112)  (2112)
               (21111)  (11121)
                        (11211)
                        (12111)
		

Crossrefs

Removing all zeros gives A238279.
The version for anti-runs is A106356.
The k-th composition in standard-order has A124767(k) runs.
The version counting descents is A238343.
The version counting weak ascents is A333213.

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Length[Split[#]]==k&]],{n,0,10},{k,0,n}]

A333213 Triangle read by rows where T(n,k) is the number of compositions of n with k adjacent terms that are equal or increasing (weak ascents) n >= 0, 0 <= k <= n.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 2, 1, 1, 0, 2, 4, 1, 1, 0, 3, 6, 5, 1, 1, 0, 4, 10, 10, 6, 1, 1, 0, 5, 17, 20, 13, 7, 1, 1, 0, 6, 27, 38, 31, 16, 8, 1, 1, 0, 8, 40, 69, 67, 42, 19, 9, 1, 1, 0, 10, 58, 123, 132, 101, 54, 22, 10, 1, 1
Offset: 0

Views

Author

Gus Wiseman, Mar 14 2020

Keywords

Comments

A composition of n is a finite sequence of positive integers summing to n.
Also the number of compositions of n with k + 1 maximal strictly decreasing subsequences.
Also the number of compositions of n with k adjacent terms that are equal or decreasing (weak descents).

Examples

			Triangle begins:
   1
   0   1
   0   1   1
   0   2   1   1
   0   2   4   1   1
   0   3   6   5   1   1
   0   4  10  10   6   1   1
   0   5  17  20  13   7   1   1
   0   6  27  38  31  16   8   1   1
   0   8  40  69  67  42  19   9   1   1
   0  10  58 123 132 101  54  22  10   1   1
   0  12  86 202 262 218 139  67  25  11   1   1
   0  15 121 332 484 467 324 182  81  28  12   1   1
Row n = 6 counts the following compositions:
  (6)    (15)    (114)   (1113)   (11112)  (111111)
  (42)   (24)    (123)   (1122)
  (51)   (33)    (222)   (11121)
  (321)  (132)   (1131)  (11211)
         (141)   (1212)  (12111)
         (213)   (1221)  (21111)
         (231)   (1311)
         (312)   (2112)
         (411)   (2211)
         (2121)  (3111)
		

Crossrefs

Compositions by length are A007318.
The case of reversed partitions (instead of compositions) is A008284.
The version counting equal adjacencies is A106356.
The case of partitions (instead of compositions) is A133121.
The version counting unequal adjacencies is A238279.
The strict/strong version is A238343.

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Length[Split[#,#1>#2&]]==k&]],{n,0,12},{k,0,n}]
  • PARI
    T(n)={my(M=matrix(n+1, n+1)); M[1,1]=x; for(n=1, n, for(k=1, n, M[1+n,1+k] = M[1+n,1+k-1] + x*M[1+n-k, 1+n-k] + (1-x)*M[1+n-k, 1+min(k-1, n-k)])); M[1,1]=1; vector(n+1, i, Vecrev(M[i,i]))}
    { my(A=T(12)); for(i=1, #A, print(A[i])) } \\ Andrew Howroyd, Jan 19 2023

A374629 Irregular triangle listing the leaders of maximal weakly increasing runs in the n-th composition in standard order.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Jul 20 2024

Keywords

Comments

The leaders of maximal weakly increasing runs in a sequence are obtained by splitting it into maximal weakly increasing subsequences and taking the first term of each.
The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.

Examples

			The 58654th composition in standard order is (1,1,3,2,4,1,1,1,2), with maximal weakly increasing runs ((1,1,3),(2,4),(1,1,1,2)), so row 58654 is (1,2,1).
The nonnegative integers, corresponding compositions, and leaders of maximal weakly increasing runs begin:
    0:      () -> ()      15: (1,1,1,1) -> (1)
    1:     (1) -> (1)     16:       (5) -> (5)
    2:     (2) -> (2)     17:     (4,1) -> (4,1)
    3:   (1,1) -> (1)     18:     (3,2) -> (3,2)
    4:     (3) -> (3)     19:   (3,1,1) -> (3,1)
    5:   (2,1) -> (2,1)   20:     (2,3) -> (2)
    6:   (1,2) -> (1)     21:   (2,2,1) -> (2,1)
    7: (1,1,1) -> (1)     22:   (2,1,2) -> (2,1)
    8:     (4) -> (4)     23: (2,1,1,1) -> (2,1)
    9:   (3,1) -> (3,1)   24:     (1,4) -> (1)
   10:   (2,2) -> (2)     25:   (1,3,1) -> (1,1)
   11: (2,1,1) -> (2,1)   26:   (1,2,2) -> (1)
   12:   (1,3) -> (1)     27: (1,2,1,1) -> (1,1)
   13: (1,2,1) -> (1,1)   28:   (1,1,3) -> (1)
   14: (1,1,2) -> (1)     29: (1,1,2,1) -> (1,1)
		

Crossrefs

Row-leaders are A065120.
Row-lengths are A124766.
Row-sums are A374630.
Positions of constant rows are A374633, counted by A374631.
Positions of strict rows are A374768, counted by A374632.
For other types of runs we have A374251, A374515, A374683, A374740, A374757.
Positions of non-weakly decreasing rows are A375137.
A011782 counts compositions.
A238130, A238279, A333755 count compositions by number of runs.
A335456 counts patterns matched by compositions.
All of the following pertain to compositions in standard order:
- Length is A000120.
- Sum is A029837(n+1).
- Leader is A065120.
- Parts are listed by A066099, reverse A228351.
- Number of adjacent equal pairs is A124762, unequal A333382.
- Number of max runs: A124765, A124766, A124767, A124768, A124769, A333381.
- Ranks of anti-run compositions are A333489, counted by A003242.
- Run-length transform is A333627, length A124767, sum A070939.
- Run-compression transform is A373948, sum A373953, excess A373954.
- Ranks of contiguous compositions are A374249, counted by A274174.
- Ranks of non-contiguous compositions are A374253, counted by A335548.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    Table[First/@Split[stc[n],LessEqual],{n,0,100}]

A373949 Triangle read by rows where T(n,k) is the number of integer compositions of n such that replacing each run of repeated parts with a single part (run-compression) yields a composition of k.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 0, 3, 0, 1, 1, 2, 4, 0, 1, 0, 4, 4, 7, 0, 1, 1, 5, 6, 5, 14, 0, 1, 0, 6, 10, 10, 14, 23, 0, 1, 1, 6, 14, 12, 29, 26, 39, 0, 1, 0, 9, 16, 19, 40, 54, 46, 71, 0, 1, 1, 8, 22, 22, 64, 82, 96, 92, 124, 0, 1, 0, 10, 26, 30, 82, 137, 144, 204, 176, 214
Offset: 0

Views

Author

Gus Wiseman, Jun 28 2024

Keywords

Examples

			Triangle begins:
   1
   0   1
   0   1   1
   0   1   0   3
   0   1   1   2   4
   0   1   0   4   4   7
   0   1   1   5   6   5  14
   0   1   0   6  10  10  14  23
   0   1   1   6  14  12  29  26  39
   0   1   0   9  16  19  40  54  46  71
   0   1   1   8  22  22  64  82  96  92 124
   0   1   0  10  26  30  82 137 144 204 176 214
   0   1   1  11  32  31 121 186 240 331 393 323 378
Row n = 6 counts the following compositions:
  .  (111111)  (222)  (33)     (3111)   (411)   (6)
                      (2211)   (1113)   (114)   (51)
                      (1122)   (1221)   (1311)  (15)
                      (21111)  (12111)  (1131)  (42)
                      (11112)  (11211)  (2112)  (24)
                               (11121)          (141)
                                                (321)
                                                (312)
                                                (231)
                                                (213)
                                                (132)
                                                (123)
                                                (2121)
                                                (1212)
For example, the composition (1,2,2,1) with compression (1,2,1) is counted under T(6,4).
		

Crossrefs

Column k = n is A003242 (anti-runs or compressed compositions).
Row-sums are A011782.
Same as A373951 with rows reversed.
Column k = 3 is A373952.
This statistic is represented by A373953, difference A373954.
A114901 counts compositions with no isolated parts.
A116861 counts partitions by compressed sum, by compressed length A116608.
A124767 counts runs in standard compositions, anti-runs A333381.
A240085 counts compositions with no unique parts.
A333755 counts compositions by compressed length.
A373948 represents the run-compression transformation.

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations /@ IntegerPartitions[n],Total[First/@Split[#]]==k&]], {n,0,10},{k,0,n}]
  • PARI
    T_xy(row_max) = {my(N=row_max+1, x='x+O('x^N), h=1/(1-sum(i=1,N, (y^i*x^i)/(1+x^i*(y^i-1))))); vector(N, n, Vecrev(polcoeff(h, n-1)))}
    T_xy(13) \\ John Tyler Rascoe, Mar 20 2025

Formula

G.f.: 1/(1 - Sum_{i>0} (y^i * x^i)/(1 + x^i * (y^i - 1))). - John Tyler Rascoe, Mar 20 2025

A124766 Number of monotonically increasing runs for compositions in standard order.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The standard order of compositions is given by A066099.
A composition of n is a finite sequence of positive integers summing to n. The k-th composition in standard order (row k of A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. a(n) is the number of maximal weakly increasing runs in this composition. Alternatively, a(n) is one plus the number of strict descents in the same composition. For example, the weakly increasing runs of the 1234567th composition are ((3),(2),(1,2,2),(1,2,5),(1,1,1)), so a(1234567) = 5. The 4 strict descents together with the weak ascents are: 3 > 2 > 1 <= 2 <= 2 > 1 <= 2 <= 5 > 1 <= 1 <= 1. - Gus Wiseman, Apr 08 2020

Examples

			Composition number 11 is 2,1,1; the increasing runs are 2; 1,1; so a(11) = 2.
The table starts:
  0
  1
  1 1
  1 2 1 1
  1 2 1 2 1 2 1 1
  1 2 2 2 1 2 2 2 1 2 1 2 1 2 1 1
  1 2 2 2 1 3 2 2 1 2 1 2 2 3 2 2 1 2 2 2 1 2 2 2 1 2 1 2 1 2 1 1
		

Crossrefs

Cf. A066099, A124761, A011782 (row lengths).
Compositions of n with k strict descents are A238343.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Sum is A070939.
- Weakly decreasing compositions are A114994.
- Adjacent equal pairs are counted by A124762.
- Weakly decreasing runs are counted by A124765.
- Weakly increasing runs are counted by A124766 (this sequence).
- Equal runs are counted by A124767.
- Strictly increasing runs are counted by A124768.
- Strictly decreasing runs are counted by A124769.
- Weakly increasing compositions are A225620.
- Reverse is A228351 (triangle).
- Strict compositions are A233564.
- Initial intervals are A246534.
- Constant compositions are A272919.
- Normal compositions are A333217.
- Permutations are A333218.
- Strictly decreasing compositions are A333255.
- Strictly increasing compositions are A333256.
- Runs-resistance is A333628.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    Table[Length[Split[stc[n],#1<=#2&]],{n,0,100}] (* Gus Wiseman, Apr 08 2020 *)

Formula

a(0) = 0, a(n) = A124761(n) + 1 for n > 0.

A124768 Number of strictly increasing runs for compositions in standard order.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The standard order of compositions is given by A066099.
A composition of n is a finite sequence of positive integers summing to n. The k-th composition in standard order (row k of A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. a(n) is the number of maximal strictly increasing runs in this composition. Alternatively, a(n) is one plus the number of weak descents in the same composition. For example, the strictly increasing runs of the 1234567th composition are ((3),(2),(1,2),(2),(1,2,5),(1),(1),(1)), so a(1234567) = 8. The 7 weak descents together with the strict ascents are: 3 >= 2 >= 1 < 2 >= 2 >= 1 < 2 < 5 >= 1 >= 1 >= 1. - Gus Wiseman, Apr 08 2020

Examples

			Composition number 11 is 2,1,1; the strictly increasing runs are 2; 1; 1; so a(11) = 3.
The table starts:
  0
  1
  1 2
  1 2 1 3
  1 2 2 3 1 2 2 4
  1 2 2 3 1 3 2 4 1 2 2 3 2 3 3 5
  1 2 2 3 2 3 2 4 1 2 3 4 2 3 3 5 1 2 2 3 1 3 2 4 2 3 3 4 3 4 4 6
		

Crossrefs

Cf. A066099, A124763, A011782 (row lengths).
Compositions of n with k weak descents are A333213.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Partial sums from the right are A048793.
- Sum is A070939.
- Weakly decreasing compositions are A114994.
- Adjacent equal pairs are counted by A124762.
- Weakly decreasing runs are counted by A124765.
- Weakly increasing runs are counted by A124766.
- Equal runs are counted by A124767.
- Strictly increasing runs are counted by A124768 (this sequence).
- Strictly decreasing runs are counted by A124769.
- Weakly increasing compositions are A225620.
- Reverse is A228351 (triangle).
- Strict compositions are A233564.
- Initial intervals are A246534.
- Constant compositions are A272919.
- Normal compositions are A333217.
- Permutations are A333218.
- Heinz number is A333219.
- Strictly decreasing compositions are A333255.
- Strictly increasing compositions are A333256.
- Anti-runs are A333489.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    Table[Length[Split[stc[n],Less]],{n,0,100}] (* Gus Wiseman, Apr 08 2020 *)

Formula

a(0) = 0, a(n) = A124763(n) + 1 for n > 0.

A189076 Number of compositions of n that avoid the pattern 23-1.

Original entry on oeis.org

1, 1, 2, 4, 8, 16, 31, 61, 118, 228, 440, 846, 1623, 3111, 5955, 11385, 21752, 41530, 79250, 151161, 288224, 549408, 1047034, 1995000, 3800662, 7239710, 13789219, 26261678, 50012275, 95237360, 181350695, 345315255, 657506300, 1251912618, 2383636280, 4538364446
Offset: 0

Views

Author

N. J. A. Sloane, Apr 16 2011

Keywords

Comments

Note that an exponentiation ^(-1) is missing in Example 4.4. The notation in Theorem 4.3 is complete.
Theorem: The reverse of a composition avoids 23-1 iff its leaders of maximal weakly increasing runs are weakly decreasing. For example, the composition y = (3,2,1,2,2,1,2,5,1,1,1) has maximal weakly increasing runs ((3),(2),(1,2,2),(1,2,5),(1,1,1)), with leaders (3,2,1,1,1), which are weakly decreasing, so the reverse of y is counted under a(21). - Gus Wiseman, Aug 19 2024

Examples

			From _Gus Wiseman_, Aug 19 2024: (Start)
The a(6) = 31 compositions:
  .  (6)  (5,1)  (4,1,1)  (3,1,1,1)  (2,1,1,1,1)  (1,1,1,1,1,1)
          (1,5)  (1,4,1)  (1,3,1,1)  (1,2,1,1,1)
          (4,2)  (1,1,4)  (1,1,3,1)  (1,1,2,1,1)
          (2,4)  (3,2,1)  (1,1,1,3)  (1,1,1,2,1)
          (3,3)  (3,1,2)  (2,2,1,1)  (1,1,1,1,2)
                 (2,3,1)  (2,1,2,1)
                 (2,1,3)  (2,1,1,2)
                 (1,2,3)  (1,2,2,1)
                 (2,2,2)  (1,2,1,2)
                          (1,1,2,2)
Missing is (1,3,2), reverse of (2,3,1).
(End)
		

Crossrefs

The non-dashed version is A102726.
The version for 3-12 is A188900, complement A375406.
Avoiding 12-1 also gives A188920 in reverse.
The version for 13-2 is A189077.
For identical leaders we have A374631, ranks A374633.
For distinct leaders we have A374632, ranks A374768.
The complement is counted by A374636, ranks A375137.
A011782 counts compositions.
A238130, A238279, A333755 count compositions by number of runs.

Programs

  • Maple
    A189075 := proc(n) local g,i; g := 1; for i from 1 to n do 1-x^i/mul ( 1-x^j,j=i+1..n-i) ; g := g*% ; end do: g := expand(1/g) ; g := taylor(g,x=0,n+1) ; coeftayl(g,x=0,n) ; end proc: # R. J. Mathar, Apr 16 2011
  • Mathematica
    a[n_] := Module[{g = 1, xi}, Do[xi = 1 - x^i/Product[1 - x^j, {j, i+1, n-i}]; g = g xi, {i, n}]; SeriesCoefficient[1/g, {x, 0, n}]];
    a /@ Range[0, 32] (* Jean-François Alcover, Apr 02 2020, after R. J. Mathar *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],!MatchQ[#,{_,y_,z_,_,x_,_}/;xGus Wiseman, Aug 19 2024 *)

A188920 a(n) is the limiting term of the n-th column of the triangle in A188919.

Original entry on oeis.org

1, 1, 2, 4, 7, 13, 22, 38, 63, 105, 169, 274, 434, 686, 1069, 1660, 2548, 3897, 5906, 8911, 13352, 19917, 29532, 43605, 64056, 93715, 136499, 198059, 286233, 412199, 591455, 845851, 1205687, 1713286, 2427177, 3428611, 4829563, 6784550, 9505840, 13284849
Offset: 0

Views

Author

N. J. A. Sloane, Apr 13 2011

Keywords

Comments

Also the number of integer compositions of n whose reverse avoids 12-1 and 23-1.
Theorem: The reverse of a composition avoids 12-1 and 23-1 iff its leaders of maximal weakly increasing runs, obtained by splitting it into maximal weakly increasing subsequences and taking the first term of each, are strictly decreasing. For example, the composition y = (4,5,3,2,2,3,1,3,5) has reverse (5,3,1,3,2,2,3,5,4), which avoids 12-1 and 23-1, while the maximal weakly increasing runs of y are ((4,5),(3),(2,2,3),(1,3,5)), with leaders (4,3,2,1), which are strictly decreasing, as required. - Gus Wiseman, Aug 20 2024

Examples

			From _Gus Wiseman_, Aug 20 2024: (Start)
The a(0) = 1 through a(6) = 22 compositions:
  ()  (1)  (2)   (3)    (4)     (5)      (6)
           (11)  (12)   (13)    (14)     (15)
                 (21)   (22)    (23)     (24)
                 (111)  (31)    (32)     (33)
                        (112)   (41)     (42)
                        (211)   (113)    (51)
                        (1111)  (122)    (114)
                                (212)    (123)
                                (221)    (132)
                                (311)    (213)
                                (1112)   (222)
                                (2111)   (312)
                                (11111)  (321)
                                         (411)
                                         (1113)
                                         (1122)
                                         (2112)
                                         (2211)
                                         (3111)
                                         (11112)
                                         (21111)
                                         (111111)
(End)
		

Crossrefs

For leaders of identical runs we have A000041.
Matching 23-1 only gives A189076.
An opposite version is A358836.
For identical leaders we have A374631, ranks A374633.
For distinct leaders we have A374632, ranks A374768.
For weakly increasing leaders we have A374635.
For non-weakly decreasing leaders we have A374636, ranks A375137.
For leaders of anti-runs we have A374680.
For leaders of strictly increasing runs we have A374689.
The complement is counted by A375140, ranks A375295, reverse A375296.
A011782 counts compositions.
A238130, A238279, A333755 count compositions by number of runs.

Programs

  • Mathematica
    b[u_, o_] := b[u, o] = Expand[If[u + o == 0, 1, Sum[b[u - j, o + j - 1]*x^(o + j - 1), {j, 1, u}] + Sum[If[u == 0, b[u + j - 1, o - j]*x^(o - j), 0], {j, 1, o}]]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][ b[0, n]];
    Take[T[40], 40] (* Jean-François Alcover, Sep 15 2018, after Alois P. Heinz in A188919 *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], Greater@@First/@Split[Reverse[#],LessEqual]&]],{n,0,15}] (* Gus Wiseman, Aug 20 2024 *)
    - or -
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], !MatchQ[#,{_,y_,z_,_,x_,_}/;x<=yGus Wiseman, Aug 20 2024 *)
  • PARI
    B_x(i,N) = {my(x='x+O('x^N), f=(x^i)/(1-x^i)*prod(j=i+1,N-i,1/(1-x^j))); f}
    A_x(N) = {my(x='x+O('x^N), f=1+sum(i=1,N, B_x(i,N)*prod(j=1,i-1,1+B_x(j,N)))); Vec(f)}
    A_x(60) \\ John Tyler Rascoe, Aug 23 2024

Formula

a(n) = 2^(n-1) - A375140(n).
G.f.: 1 + Sum_{i>0} (B(i,x) * Product_{j=1..i-1} (1 + B(j,x))) where B(i,x) = (x^i)/(1-x^i) * Product_{j>i} (1/(1-x^j)). - John Tyler Rascoe, Aug 23 2024

Extensions

More terms from Andrew Baxter, May 17 2011
a(30)-a(39) from Alois P. Heinz, Nov 14 2015
Showing 1-10 of 117 results. Next