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 10 results.

A114901 Number of compositions of n such that each part is adjacent to an equal part.

Original entry on oeis.org

1, 0, 1, 1, 2, 1, 5, 3, 10, 10, 21, 22, 49, 51, 105, 126, 233, 292, 529, 678, 1181, 1585, 2654, 3654, 6016, 8416, 13606, 19395, 30840, 44517, 70087, 102070, 159304, 233941, 362429, 535520, 825358, 1225117, 1880220, 2801749, 4285086, 6404354, 9769782, 14634907
Offset: 0

Views

Author

Christian G. Bower, Jan 05 2006

Keywords

Examples

			The 5 compositions of 6 are 3+3, 2+2+2, 2+2+1+1, 1+1+2+2, 1+1+1+1+1+1.
From _Gus Wiseman_, Nov 25 2019: (Start)
The a(2) = 1 through a(9) = 10 compositions:
  (11)  (111)  (22)    (11111)  (33)      (11122)    (44)        (333)
               (1111)           (222)     (22111)    (1133)      (11133)
                                (1122)    (1111111)  (2222)      (33111)
                                (2211)               (3311)      (111222)
                                (111111)             (11222)     (222111)
                                                     (22211)     (1111122)
                                                     (111122)    (1112211)
                                                     (112211)    (1122111)
                                                     (221111)    (2211111)
                                                     (11111111)  (111111111)
(End)
		

Crossrefs

The case of partitions is A007690.
Compositions with no adjacent parts equal are A003242.
Compositions with all multiplicities > 1 are A240085.
Compositions with minimum multiplicity 1 are A244164.
Compositions with at least two adjacent parts equal are A261983.

Programs

  • Maple
    g:= proc(n, i) option remember; add(b(n-i*j, i), j=2..n/i) end:
    b:= proc(n, l) option remember; `if`(n=0, 1,
          add(`if`(i=l, 0, g(n,i)), i=1..n/2))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..50);  # Alois P. Heinz, Nov 29 2019
  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Min@@Length/@Split[#]>1&]],{n,0,10}] (* Gus Wiseman, Nov 25 2019 *)
    g[n_, i_] := g[n, i] = Sum[b[n - i*j, i], {j, 2, n/i}] ;
    b[n_, l_] := b[n, l] = If[n==0, 1, Sum[If[i==l, 0, g[n, i]], {i, 1, n/2}]];
    a[n_] := b[n, 0];
    a /@ Range[0, 50] (* Jean-François Alcover, May 23 2021, after Alois P. Heinz *)
  • PARI
    A_x(N,k) = { my(x='x+O('x^N), g=1/(1-sum(i=1,N,sum(j=k+1,N, x^(i*j))/(1+ sum(j=k+1,N, x^(i*j)))))); Vec(g)}
    A_x(50,1) \\ John Tyler Rascoe, May 17 2024

Formula

INVERT(iMOEBIUS(iINVERT(A000012 shifted right 2 places)))
G.f.: A(x,1) is the k = 1 case of A(x,k) = 1/(1 - Sum_{i>0} ( (Sum_{j>k} x^(i*j))/(1 + Sum_{j>k} x^(i*j)) )) where A(x,k) is the g.f. for compositions of n with all run-lengths > k. - John Tyler Rascoe, May 16 2024

A261983 Number of compositions of n such that at least two adjacent parts are equal.

Original entry on oeis.org

0, 0, 1, 1, 4, 9, 18, 41, 89, 185, 388, 810, 1670, 3435, 7040, 14360, 29226, 59347, 120229, 243166, 491086, 990446, 1995410, 4016259, 8076960, 16231746, 32599774, 65437945, 131293192, 263316897, 527912140, 1058061751, 2120039885, 4246934012, 8505864640
Offset: 0

Views

Author

Alois P. Heinz, Sep 07 2015

Keywords

Examples

			a(5) = 9: 311, 113, 221, 122, 2111, 1211, 1121, 1112, 11111.
From _Gus Wiseman_, Jul 07 2020: (Start)
The a(2) = 1 through a(6) = 18 compositions:
  (1,1)  (1,1,1)  (2,2)      (1,1,3)      (3,3)
                  (1,1,2)    (1,2,2)      (1,1,4)
                  (2,1,1)    (2,2,1)      (2,2,2)
                  (1,1,1,1)  (3,1,1)      (4,1,1)
                             (1,1,1,2)    (1,1,1,3)
                             (1,1,2,1)    (1,1,2,2)
                             (1,2,1,1)    (1,1,3,1)
                             (2,1,1,1)    (1,2,2,1)
                             (1,1,1,1,1)  (1,3,1,1)
                                          (2,1,1,2)
                                          (2,2,1,1)
                                          (3,1,1,1)
                                          (1,1,1,1,2)
                                          (1,1,1,2,1)
                                          (1,1,2,1,1)
                                          (1,2,1,1,1)
                                          (2,1,1,1,1)
                                          (1,1,1,1,1,1)
(End)
		

Crossrefs

Column k=1 of A261981.
The complement A003242 counts anti-runs.
Sum of positive-indexed terms of row n of A106356.
Row sums of A131044.
The (1,1,1) matching case is A335464.
Strict compositions are A032020.
Compositions with adjacent parts coprime are A167606.
Compositions with equal parts contiguous are A274174.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 0, add(
          `if`(i=j, ceil(2^(n-j-1)), b(n-j, j)), j=1..n))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..40);
  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],MatchQ[#,{_,x_,x_,_}]&]],{n,0,10}] (* Gus Wiseman, Jul 06 2020 *)
    b[n_, i_] := b[n, i] = If[n == 0, 0, Sum[If[i == j, Ceiling[2^(n-j-1)], b[n-j, j]], {j, 1, n}]];
    a[n_] := b[n, 0];
    Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Nov 20 2023, after Alois P. Heinz's Maple code *)

Formula

a(n) ~ 2^(n-1). - Vaclav Kotesovec, Sep 08 2015
a(n) = A011782(n) - A003242(n). - Emeric Deutsch, Jul 03 2020

A348612 Numbers k such that the k-th composition in standard order is not an anti-run, i.e., has adjacent equal parts.

Original entry on oeis.org

3, 7, 10, 11, 14, 15, 19, 21, 23, 26, 27, 28, 29, 30, 31, 35, 36, 39, 42, 43, 46, 47, 51, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 67, 71, 73, 74, 75, 78, 79, 83, 84, 85, 86, 87, 90, 91, 92, 93, 94, 95, 99, 100, 103, 106, 107, 110, 111, 112, 113, 114, 115, 116
Offset: 1

Views

Author

Gus Wiseman, Nov 03 2021

Keywords

Comments

First differs from A345168 in lacking 37, corresponding to the composition (3,2,1).
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.

Examples

			The terms and corresponding standard compositions begin:
     3: (1,1)          35: (4,1,1)        61: (1,1,1,2,1)
     7: (1,1,1)        36: (3,3)          62: (1,1,1,1,2)
    10: (2,2)          39: (3,1,1,1)      63: (1,1,1,1,1,1)
    11: (2,1,1)        42: (2,2,2)        67: (5,1,1)
    14: (1,1,2)        43: (2,2,1,1)      71: (4,1,1,1)
    15: (1,1,1,1)      46: (2,1,1,2)      73: (3,3,1)
    19: (3,1,1)        47: (2,1,1,1,1)    74: (3,2,2)
    21: (2,2,1)        51: (1,3,1,1)      75: (3,2,1,1)
    23: (2,1,1,1)      53: (1,2,2,1)      78: (3,1,1,2)
    26: (1,2,2)        55: (1,2,1,1,1)    79: (3,1,1,1,1)
    27: (1,2,1,1)      56: (1,1,4)        83: (2,3,1,1)
    28: (1,1,3)        57: (1,1,3,1)      84: (2,2,3)
    29: (1,1,2,1)      58: (1,1,2,2)      85: (2,2,2,1)
    30: (1,1,1,2)      59: (1,1,2,1,1)    86: (2,2,1,2)
    31: (1,1,1,1,1)    60: (1,1,1,3)      87: (2,2,1,1,1)
		

Crossrefs

Constant run compositions are counted by A000005, ranked by A272919.
Counting these compositions by sum and length gives A131044.
These compositions are counted by A261983.
The complement is A333489, counted by A003242.
The non-alternating case is A345168, complement A345167.
A011782 counts compositions, strict A032020.
A238279 counts compositions by sum and number of maximal runs.
A274174 counts compositions with equal parts contiguous.
A336107 counts non-anti-run permutations of prime factors.
A345195 counts non-alternating anti-runs, ranked by A345169.
For compositions in standard order (rows of A066099):
- Length is A000120.
- Sum is A070939
- Maximal runs are counted by A124767.
- Strict compositions are ranked by A233564.
- Maximal anti-runs are counted by A333381.
- Runs-resistance is A333628.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    Select[Range[100],MatchQ[stc[#],{_,x_,x_,_}]&]

A329766 Number of compositions of n whose run-lengths cover an initial interval of positive integers.

Original entry on oeis.org

1, 1, 1, 3, 6, 13, 21, 48, 89, 180, 355, 707, 1382, 2758, 5448, 10786, 21391, 42476, 84291, 167516, 333036, 662153, 1317687, 2622706, 5221951, 10400350, 20720877, 41288823, 82294979, 164052035, 327088649, 652238016, 1300788712, 2594486045, 5175378128, 10324522020
Offset: 0

Views

Author

Gus Wiseman, Nov 20 2019

Keywords

Comments

A composition of n is a finite sequence of positive integers with sum n.

Examples

			The a(0) = 1 through a(5) = 13 compositions:
  ()  (1)  (2)  (3)    (4)      (5)
                (1,2)  (1,3)    (1,4)
                (2,1)  (3,1)    (2,3)
                       (1,1,2)  (3,2)
                       (1,2,1)  (4,1)
                       (2,1,1)  (1,1,3)
                                (1,2,2)
                                (1,3,1)
                                (2,1,2)
                                (2,2,1)
                                (3,1,1)
                                (1,1,2,1)
                                (1,2,1,1)
		

Crossrefs

Looking at multiplicities instead of run-lengths gives A329741.
The complete case is A329749.
Complete compositions are A107429.

Programs

  • Mathematica
    normQ[m_]:=Or[m=={},Union[m]==Range[Max[m]]];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],normQ[Length/@Split[#]]&]],{n,0,10}]

Extensions

a(21)-a(26) from Giovanni Resta, Nov 22 2019
a(27)-a(35) from Alois P. Heinz, Jul 06 2020

A242451 Number T(n,k) of compositions of n in which the minimal multiplicity of parts equals k; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 3, 0, 1, 0, 6, 1, 0, 1, 0, 15, 0, 0, 0, 1, 0, 23, 7, 1, 0, 0, 1, 0, 53, 10, 0, 0, 0, 0, 1, 0, 94, 32, 0, 1, 0, 0, 0, 1, 0, 203, 31, 21, 0, 0, 0, 0, 0, 1, 0, 404, 71, 35, 0, 1, 0, 0, 0, 0, 1, 0, 855, 77, 91, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1648, 222, 105, 71, 0, 1, 0, 0, 0, 0, 0, 1
Offset: 0

Views

Author

Alois P. Heinz, May 15 2014

Keywords

Comments

T(0,0) = 1 by convention. T(n,k) counts the compositions of n in which at least one part has multiplicity k and no part has a multiplicity smaller than k.
T(n,n) = T(2n,n) = 1.
T(3n,n) = A244174(n).

Examples

			T(5,1) = 15: [1,1,1,2], [1,1,2,1], [1,2,1,1], [2,1,1,1], [1,2,2], [2,1,2], [2,2,1], [1,1,3], [1,3,1], [3,1,1], [2,3], [3,2], [1,4], [4,1], [5].
T(6,2) = 7: [1,1,2,2], [1,2,1,2], [1,2,2,1], [2,1,1,2], [2,1,2,1], [2,2,1,1], [3,3].
T(6,3) = 1: [2,2,2].
Triangle T(n,k) begins:
  1;
  0,   1;
  0,   1,  1;
  0,   3,  0,  1;
  0,   6,  1,  0, 1;
  0,  15,  0,  0, 0, 1;
  0,  23,  7,  1, 0, 0, 1;
  0,  53, 10,  0, 0, 0, 0, 1;
  0,  94, 32,  0, 1, 0, 0, 0, 1;
  0, 203, 31, 21, 0, 0, 0, 0, 0, 1;
  0, 404, 71, 35, 0, 1, 0, 0, 0, 0, 1;
		

Crossrefs

Row sums give A011782.
Cf. A242447 (the same for maximal multiplicity), A243978 (the same for partitions).

Programs

  • Maple
    b:= proc(n, i, p, k) option remember; `if`(n=0, p!, `if`(i<1, 0,
           b(n, i-1, p, k) +add(b(n-i*j, i-1, p+j, k)/j!,
           j=max(1, k)..floor(n/i))))
        end:
    T:= (n, k)-> b(n$2, 0, k) -`if`(n=0 and k=0, 0, b(n$2, 0, k+1)):
    seq(seq(T(n, k), k=0..n), n=0..14);
  • Mathematica
    b[n_, i_, p_, k_] := b[n, i, p, k] = If[n == 0, p!, If[i < 1, 0, b[n, i - 1, p, k] + Sum[b[n - i*j, i - 1, p + j, k]/j!, {j, Max[1, k], Floor[n/i]}]]]; T[n_, k_] := b[n, n, 0, k] - If[n == 0 && k == 0, 0, b[n, n, 0, k + 1]]; Table[Table[T[n, k], {k, 0, n}], {n, 0, 14}] // Flatten (* Jean-François Alcover, Jan 27 2015, after Alois P. Heinz *)

A329740 Number of compositions of n whose multiplicities are distinct and cover an initial interval of positive integers.

Original entry on oeis.org

1, 1, 1, 1, 4, 7, 4, 10, 10, 10, 73, 196, 133, 379, 319, 379, 502, 805, 562, 1108, 13648, 51448, 51691, 115174, 140011, 178597, 203617, 329737, 292300, 456703, 456160, 608386, 633466, 898186, 823009, 39014392, 190352269, 266293795, 493345615, 834326995, 947714938
Offset: 0

Views

Author

Gus Wiseman, Nov 21 2019

Keywords

Comments

A composition of n is a finite sequence of positive integers with sum n.

Examples

			The a(1) = 1 through a(9) = 10 compositions:
  (1)  (2)  (3)  (4)      (5)      (6)      (7)      (8)      (9)
                 (1,1,2)  (1,1,3)  (1,1,4)  (1,1,5)  (1,1,6)  (1,1,7)
                 (1,2,1)  (1,2,2)  (1,4,1)  (1,3,3)  (1,6,1)  (1,4,4)
                 (2,1,1)  (1,3,1)  (4,1,1)  (1,5,1)  (2,2,4)  (1,7,1)
                          (2,1,2)           (2,2,3)  (2,3,3)  (2,2,5)
                          (2,2,1)           (2,3,2)  (2,4,2)  (2,5,2)
                          (3,1,1)           (3,1,3)  (3,2,3)  (4,1,4)
                                            (3,2,2)  (3,3,2)  (4,4,1)
                                            (3,3,1)  (4,2,2)  (5,2,2)
                                            (5,1,1)  (6,1,1)  (7,1,1)
		

Crossrefs

The version allowing repeated multiplicities is A329741.
Complete compositions are A107429.
Compositions whose multiplicities are distinct are A242882.

Programs

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

Extensions

a(21)-a(40) from Alois P. Heinz, Nov 21 2019

A329741 Number of compositions of n whose multiplicities cover an initial interval of positive integers.

Original entry on oeis.org

1, 1, 1, 3, 6, 11, 14, 34, 52, 114, 225, 464, 539, 1183, 1963, 3753, 6120, 11207, 19808, 38254, 77194, 147906, 224853, 374216, 611081, 1099933, 2129347, 3336099, 5816094, 9797957, 17577710, 29766586, 53276392, 93139668, 163600815, 324464546, 637029845, 1010826499
Offset: 0

Views

Author

Gus Wiseman, Nov 20 2019

Keywords

Comments

A composition of n is a finite sequence of positive integers with sum n.

Examples

			The a(1) = 1 through a(6) = 14 compositions:
  (1)  (2)  (3)    (4)      (5)      (6)
            (1,2)  (1,3)    (1,4)    (1,5)
            (2,1)  (3,1)    (2,3)    (2,4)
                   (1,1,2)  (3,2)    (4,2)
                   (1,2,1)  (4,1)    (5,1)
                   (2,1,1)  (1,1,3)  (1,1,4)
                            (1,2,2)  (1,2,3)
                            (1,3,1)  (1,3,2)
                            (2,1,2)  (1,4,1)
                            (2,2,1)  (2,1,3)
                            (3,1,1)  (2,3,1)
                                     (3,1,2)
                                     (3,2,1)
                                     (4,1,1)
		

Crossrefs

Looking at run-lengths instead of multiplicities gives A329766.
The complete case is A329748.
Complete compositions are A107429.

Programs

  • Mathematica
    normQ[m_]:=Or[m=={},Union[m]==Range[Max[m]]];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],normQ[Length/@Split[Sort[#]]]&]],{n,20}]

Extensions

a(0), a(21)-a(37) from Alois P. Heinz, Nov 21 2019

A353427 Numbers k such that the k-th composition in standard order has all run-lengths > 1.

Original entry on oeis.org

0, 3, 7, 10, 15, 31, 36, 42, 43, 58, 63, 87, 122, 127, 136, 147, 170, 171, 175, 228, 234, 235, 250, 255, 292, 295, 343, 351, 471, 484, 490, 491, 506, 511, 528, 547, 586, 591, 676, 682, 683, 687, 698, 703, 904, 915, 938, 939, 943, 983, 996, 1002, 1003, 1018
Offset: 1

Views

Author

Gus Wiseman, May 16 2022

Keywords

Comments

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 terms and corresponding compositions begin:
     0: ()
     3: (1,1)
     7: (1,1,1)
    10: (2,2)
    15: (1,1,1,1)
    31: (1,1,1,1,1)
    36: (3,3)
    42: (2,2,2)
    43: (2,2,1,1)
    58: (1,1,2,2)
    63: (1,1,1,1,1,1)
    87: (2,2,1,1,1)
   122: (1,1,1,2,2)
   127: (1,1,1,1,1,1,1)
		

Crossrefs

The version for partitions is A001694, counted by A007690.
The version for parts instead of lengths is A022340, counted by A212804.
These compositions are counted by A114901.
A subset of A348612 (counted by A261983).
The case of all run-lengths = 2 is A351011.
The case of all run-lengths > 2 is counted by A353400.
A005811 counts runs in binary expansion.
A011782 counts compositions.
A066099 lists compositions in standard order, reverse A228351.
Statistics of standard compositions:
- Length is A000120, sum A070939.
- Runs are counted by A124767.
- Runs-resistance is A333628.
- Run-lengths are A333769.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    Select[Range[0,100],!MemberQ[Length/@Split[stc[#]],1]&]

A329748 Number of complete compositions of n whose multiplicities cover an initial interval of positive integers.

Original entry on oeis.org

1, 1, 0, 2, 3, 3, 6, 12, 12, 42, 114, 210, 60, 360, 720, 1320, 1590, 3690, 6450, 16110, 33120, 59940, 61320, 112980, 171780, 387240, 803880, 769440, 1773240, 2823240, 5790960, 9916200, 19502280, 28244160, 56881440, 130548600, 279578880, 320554080, 541323720
Offset: 0

Views

Author

Gus Wiseman, Nov 21 2019

Keywords

Comments

A composition of n is a finite sequence of positive integers with sum n. It is complete if it covers an initial interval of positive integers.

Examples

			The a(1) = 1 through a(8) = 12 compositions (empty column not shown):
  (1)  (12)  (112)  (122)  (123)  (1123)  (1223)
       (21)  (121)  (212)  (132)  (1132)  (1232)
             (211)  (221)  (213)  (1213)  (1322)
                           (231)  (1231)  (2123)
                           (312)  (1312)  (2132)
                           (321)  (1321)  (2213)
                                  (2113)  (2231)
                                  (2131)  (2312)
                                  (2311)  (2321)
                                  (3112)  (3122)
                                  (3121)  (3212)
                                  (3211)  (3221)
		

Crossrefs

Looking at run-lengths instead of multiplicities gives A329749.
The non-complete version is A329741.
Complete compositions are A107429.

Programs

  • Mathematica
    normQ[m_]:=Or[m=={},Union[m]==Range[Max[m]]];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],normQ[#]&&normQ[Length/@Split[Sort[#]]]&]],{n,0,10}]

Extensions

a(21)-a(38) from Alois P. Heinz, Jul 06 2020

A329749 Number of complete compositions of n whose run-lengths cover an initial interval of positive integers.

Original entry on oeis.org

1, 1, 0, 2, 3, 5, 11, 23, 40, 80, 180, 344, 661, 1321, 2657, 5268, 10481, 20903, 41572, 82734, 164998, 328304, 654510, 1305421, 2598811, 5182174, 10332978, 20594318, 41066611, 81897091, 163309679, 325707492, 649648912, 1295827380, 2584941276, 5156774487
Offset: 0

Views

Author

Gus Wiseman, Nov 21 2019

Keywords

Comments

A composition of n is a finite sequence of positive integers with sum n. It is complete if it covers an initial interval of positive integers.

Examples

			The a(0) = 1 through a(6) = 11 compositions (empty column not shown):
  ()  (1)  (1,2)  (1,1,2)  (1,2,2)    (1,2,3)
           (2,1)  (1,2,1)  (2,1,2)    (1,3,2)
                  (2,1,1)  (2,2,1)    (2,1,3)
                           (1,1,2,1)  (2,3,1)
                           (1,2,1,1)  (3,1,2)
                                      (3,2,1)
                                      (1,2,1,2)
                                      (1,2,2,1)
                                      (2,1,1,2)
                                      (2,1,2,1)
                                      (1,1,2,1,1)
		

Crossrefs

Looking at multiplicities instead of run-lengths gives A329748.
The non-complete version is A329766.
Complete compositions are A107429.

Programs

  • Mathematica
    normQ[m_]:=Or[m=={},Union[m]==Range[Max[m]]];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],normQ[#]&&normQ[Length/@Split[#]]&]],{n,0,10}]

Extensions

a(21)-a(35) from Alois P. Heinz, Jul 06 2020
Showing 1-10 of 10 results.