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

A261982 Number of compositions of n with some part repeated.

Original entry on oeis.org

0, 0, 1, 1, 5, 11, 21, 51, 109, 229, 455, 959, 1947, 3963, 7999, 16033, 32333, 64919, 130221, 260967, 522733, 1045825, 2093855, 4189547, 8382315, 16768455, 33543127, 67093261, 134193413, 268404995, 536829045, 1073686083, 2147408773, 4294869253, 8589803783
Offset: 0

Views

Author

Alois P. Heinz, Sep 07 2015

Keywords

Comments

Also compositions matching the pattern (1,1). - Gus Wiseman, Jun 23 2020

Examples

			a(2) = 1: 11.
a(3) = 1: 111.
a(4) = 5: 22, 211, 121, 112, 1111.
		

Crossrefs

Row sums of A261981 and of A262191.
Cf. A262047.
The version for patterns is A019472.
The (1,1)-avoiding version is A032020.
The case of partitions is A047967.
(1,1,1)-matching compositions are counted by A335455.
Patterns matched by compositions are counted by A335456.
(1,1)-matching compositions are ranked by A335488.

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(k<0 or n<0, 0,
          `if`(k=0, `if`(n=0, 1, 0), b(n-k, k) +k*b(n-k, k-1)))
        end:
    a:= n-> ceil(2^(n-1))-add(b(n, k), k=0..floor((sqrt(8*n+1)-1)/2)):
    seq(a(n), n=0..40);
  • Mathematica
    b[n_, k_] := b[n, k] = If[k<0 || n<0, 0, If[k==0, If[n==0, 1, 0], b[n-k, k] + k*b[n-k, k-1]]]; a[n_] := Ceiling[2^(n-1)]-Sum[b[n, k], {k, 0, Floor[ (Sqrt[8n+1]-1)/2]}]; Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Feb 08 2017, translated from Maple *)
    Table[Length[Join@@Permutations/@Select[IntegerPartitions[n],Length[#]>Length[Split[#]]&]],{n,0,10}] (* Gus Wiseman, Jun 24 2020 *)

Formula

a(n) = A011782(n) - A032020(n).
G.f.: (1 - x) / (1 - 2*x) - Sum_{k>=0} k! * x^(k*(k + 1)/2) / Product_{j=1..k} (1 - x^j). - Ilya Gutkovskiy, Jan 30 2020

A261981 Number T(n,k) of compositions of n such that k is the minimal distance between two identical parts; triangle T(n,k), n>=2, 1<=k<=floor((sqrt(8*n-7)-1)/2), read by rows.

Original entry on oeis.org

1, 1, 4, 1, 9, 2, 18, 3, 41, 8, 2, 89, 16, 4, 185, 34, 10, 388, 57, 10, 810, 113, 30, 6, 1670, 213, 52, 12, 3435, 396, 104, 28, 7040, 733, 176, 50, 14360, 1333, 278, 62, 29226, 2419, 512, 152, 24, 59347, 4400, 878, 246, 48, 120229, 7934, 1492, 458, 108
Offset: 2

Views

Author

Alois P. Heinz, Sep 07 2015

Keywords

Examples

			T(5,1) = 9: 311, 113, 221, 122, 2111, 1211, 1121, 1112, 11111.
T(5,2) = 2: 131, 212.
T(7,2) = 8: 151, 313, 232, 3121, 1213, 2131, 1312, 12121.
T(7,3) = 2: 1231, 1321.
Triangle T(n,k) begins:
n\k:     1     2    3    4   5
---+---------------------------
02 :     1;
03 :     1;
04 :     4,    1;
05 :     9,    2;
06 :    18,    3;
07 :    41,    8,   2;
08 :    89,   16,   4;
09 :   185,   34,  10;
10 :   388,   57,  10;
11 :   810,  113,  30,   6;
12 :  1670,  213,  52,  12;
13 :  3435,  396, 104,  28;
14 :  7040,  733, 176,  50;
15 : 14360, 1333, 278,  62;
16 : 29226, 2419, 512, 152, 24;
		

Crossrefs

Columns k=1-2 give: A261983, A261984.
Row sums give A261982.

Programs

  • Maple
    b:= proc(n, l) option remember;
          `if`(n=0, 1, add(`if`(j in l, 0, b(n-j,
          `if`(l=[], [], [subsop(1=NULL, l)[], j]))), j=1..n))
        end:
    T:= (n, k)-> b(n, [0$(k-1)])-b(n, [0$k]):
    seq(seq(T(n, k), k=1..floor((sqrt(8*n-7)-1)/2)), n=2..20);
  • Mathematica
    b[n_, l_] := b[n, l] = If[n == 0, 1, Sum[If[MemberQ[l, j], 0, b[n-j, If[l == {}, {}, Append[Rest[l], j]]]], {j, 1, n}]];
    A[n_, k_] := b[n, Array[0&, Min[n, k]]];
    T[n_, k_] := A[n, k-1] - A[n, k];
    Table[T[n, k], {n, 2, 20}, {k, 1, Floor[(Sqrt[8*n-7]-1)/2]}] // Flatten (* Jean-François Alcover, Apr 13 2017, after Alois P. Heinz *)

Formula

T(n,k) = A261960(n,k-1) - A261960(n,k).
T((n+1)*(n+2)/2+1,n+1) = A000142(n) for n>=0.

A262192 Number of compositions of n such that the maximal distance between two identical parts equals one.

Original entry on oeis.org

0, 0, 1, 0, 3, 4, 5, 12, 21, 36, 43, 88, 133, 222, 331, 450, 753, 1120, 1703, 2508, 3753, 5010, 7807, 11020, 16243, 22974, 33277, 46764, 63639, 91822, 127943, 180048, 249585, 348204, 480361, 664618, 884833, 1237470, 1675087, 2299104, 3103203, 4234072, 5700371
Offset: 0

Views

Author

Alois P. Heinz, Sep 14 2015

Keywords

Examples

			a(2) = 1: 11.
a(4) = 3: 22, 112, 211.
a(5) = 4: 113, 122, 221, 311.
a(6) = 5: 33, 114, 411, 1122, 2211.
a(7) = 12: 115, 133, 223, 322, 331, 511, 1123, 1132, 2113, 2311, 3112, 3211.
a(8) = 21: 44, 116, 224, 233, 332, 422, 611, 1124, 1133, 1142, 1223, 1322, 2114, 2213, 2231, 2411, 3122, 3221, 3311, 4112, 4211.
		

Crossrefs

Column k=1 of A262191.

Programs

  • Maple
    g:= proc(n, k) option remember; `if`(k<0 or n<0, 0,
          `if`(k=0, `if`(n=0, 1, 0), g(n-k, k)+k*g(n-k, k-1)))
        end:
    b:= proc(n, i) option remember; expand(`if`(i*(i+1) (p-> add(coeff(p, x, i)*i!, i=0..degree(p)))(b(n$2))
            -add(g(n, k), k=0..floor((sqrt(8*n+1)-1)/2)):
    seq(a(n), n=0..50);
  • Mathematica
    g[n_, k_] := g[n, k] = If[k < 0 || n < 0, 0, If[k == 0, If[n == 0, 1, 0], g[n - k, k] + k*g[n - k, k - 1]]];
    b[n_, i_] := b[n, i] = Expand[If[i(i+1) < n, 0, If[n == 0, 1, If[i < 1, 0, Sum[b[n - i*j, i - 1]*If[j == 0, 1, x], {j, 0, 2}]]]]];
    a[n_] := With[{p = b[n, n]}, Sum[Coefficient[p, x, i]*i!, {i, 0, Exponent[p, x]}]] - Sum[g[n, k], {k, 0, Floor[(Sqrt[8n + 1] - 1)/2]}];
    a /@ Range[0, 50] (* Jean-François Alcover, Dec 29 2020, after Alois P. Heinz *)

A262194 Number of compositions of n such that the maximal distance between two identical parts equals two.

Original entry on oeis.org

0, 0, 0, 1, 1, 4, 6, 13, 23, 42, 68, 119, 197, 324, 530, 823, 1305, 2040, 3162, 4869, 7431, 11076, 16680, 24831, 36785, 54210, 79546, 115967, 167359, 241726, 347184, 496235, 707681, 1004534, 1421178, 2003969, 2806921, 3929770, 5479406, 7617149, 10562169
Offset: 0

Views

Author

Alois P. Heinz, Sep 14 2015

Keywords

Examples

			a(3) = 1: 111.
a(4) = 1: 121.
a(5) = 4: 131, 212, 1112, 2111.
a(6) = 6: 141, 222, 1113, 1212, 2121, 3111.
a(7) = 13: 151, 232, 313, 1114, 1213, 1222, 1312, 2131, 2221, 3121, 4111, 11122, 22111.
a(8) = 23: 161, 242, 323, 1115, 1214, 1232, 1313, 1412, 2123, 2141, 2321, 3131, 3212, 4121, 5111, 11123, 11132, 11222, 21113, 22211, 23111, 31112, 32111.
		

Crossrefs

Column k=2 of A262191.

A262196 Number of compositions of n such that the maximal distance between two identical parts equals three.

Original entry on oeis.org

0, 1, 2, 6, 12, 25, 46, 88, 152, 267, 452, 764, 1260, 2049, 3314, 5272, 8354, 13077, 20366, 31302, 48048, 72849, 110244, 165354, 247194, 366703, 541802, 796066, 1164264, 1695201, 2457904, 3549244, 5104908, 7313739, 10437170, 14848936, 21041422, 29732907
Offset: 3

Views

Author

Alois P. Heinz, Sep 14 2015

Keywords

Examples

			a(4) = 1: 1111.
a(5) = 2: 1121, 1211.
a(6) = 6: 1131, 1221, 1311, 2112, 11112, 21111.
a(7) = 12: 1141, 1231, 1321, 1411, 2122, 2212, 11113, 11212, 12112, 21121, 21211, 31111.
a(8) = 25: 1151, 1241, 1331, 1421, 1511, 2132, 2222, 2312, 3113, 11114, 11213, 11312, 12113, 12122, 12212, 13112, 21131, 21221, 21311, 22121, 31121, 31211, 41111, 111122, 221111.
		

Crossrefs

Column k=3 of A262191.

A262197 Number of compositions of n such that the maximal distance between two identical parts equals four.

Original entry on oeis.org

0, 1, 3, 9, 21, 46, 92, 180, 330, 595, 1039, 1793, 3023, 5030, 8248, 13388, 21518, 34231, 54079, 84607, 131603, 203050, 311738, 474974, 720666, 1086125, 1629815, 2431647, 3612665, 5339710, 7860366, 11519856, 16816312, 24448029, 35409609
Offset: 4

Views

Author

Alois P. Heinz, Sep 14 2015

Keywords

Examples

			a(5) = 1: 11111.
a(6) = 3: 11121, 11211, 12111.
a(7) = 9: 11131, 11221, 11311, 12121, 12211, 13111, 21112, 111112, 211111.
a(8) = 21: 11141, 11231, 11321, 11411, 12131, 12221, 12311, 13121, 13211, 14111, 21122, 21212, 22112, 111113, 111212, 112112, 121112, 211121, 211211, 212111, 311111.
		

Crossrefs

Column k=4 of A262191.

A262200 Number of compositions of n such that the maximal distance between two identical parts equals five.

Original entry on oeis.org

0, 1, 4, 13, 34, 80, 172, 352, 682, 1277, 2314, 4103, 7112, 12120, 20302, 33582, 54860, 88699, 142036, 225407, 354938, 554698, 861366, 1328654, 2038498, 3108789, 4718194, 7122619, 10705550, 16012298, 23852554, 35374650, 52262054, 76898593
Offset: 5

Views

Author

Alois P. Heinz, Sep 14 2015

Keywords

Examples

			a(6) = 1: 111111.
a(7) = 4: 111121, 111211, 112111, 121111.
a(8) = 13: 111131, 111221, 111311, 112121, 112211, 113111, 121121, 121211, 122111, 131111, 211112, 1111112, 2111111.
a(9) = 34: 111141, 111231, 111321, 111411, 112131, 112221, 112311, 113121, 113211, 114111, 121131, 121221, 121311, 122121, 122211, 123111, 131121, 131211, 132111, 141111, 211122, 211212, 212112, 221112, 1111113, 1111212, 1112112, 1121112, 1211112, 2111121, 2111211, 2112111, 2121111, 3111111.
		

Crossrefs

Column k=5 of A262191.
Showing 1-7 of 7 results.