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

A305161 Number A(n,k) of compositions of n into exactly n nonnegative parts <= k; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 3, 1, 0, 1, 1, 3, 7, 1, 0, 1, 1, 3, 10, 19, 1, 0, 1, 1, 3, 10, 31, 51, 1, 0, 1, 1, 3, 10, 35, 101, 141, 1, 0, 1, 1, 3, 10, 35, 121, 336, 393, 1, 0, 1, 1, 3, 10, 35, 126, 426, 1128, 1107, 1, 0, 1, 1, 3, 10, 35, 126, 456, 1520, 3823, 3139, 1, 0
Offset: 0

Views

Author

Alois P. Heinz, Aug 17 2018

Keywords

Examples

			A(3,1) = 1: 111.
A(3,2) = 7: 012, 021, 102, 111, 120, 201, 210.
A(3,3) = 10: 003, 012, 021, 030, 102, 111, 120, 201, 210, 300.
A(4,2) = 19: 0022, 0112, 0121, 0202, 0211, 0220, 1012, 1021, 1102, 1111, 1120, 1201, 1210, 2002, 2011, 2020, 2101, 2110, 2200.
A(4,3) = 31: 0013, 0022, 0031, 0103, 0112, 0121, 0130, 0202, 0211, 0220, 0301, 0310, 1003, 1012, 1021, 1030, 1102, 1111, 1120, 1201, 1210, 1300, 2002, 2011, 2020, 2101, 2110, 2200, 3001, 3010, 3100.
Square array A(n,k) begins:
  1, 1,    1,    1,    1,    1,    1,    1,    1, ...
  0, 1,    1,    1,    1,    1,    1,    1,    1, ...
  0, 1,    3,    3,    3,    3,    3,    3,    3, ...
  0, 1,    7,   10,   10,   10,   10,   10,   10, ...
  0, 1,   19,   31,   35,   35,   35,   35,   35, ...
  0, 1,   51,  101,  121,  126,  126,  126,  126, ...
  0, 1,  141,  336,  426,  456,  462,  462,  462, ...
  0, 1,  393, 1128, 1520, 1667, 1709, 1716, 1716, ...
  0, 1, 1107, 3823, 5475, 6147, 6371, 6427, 6435, ...
		

Crossrefs

Rows n=0-1 give: A000012, A057427.
Main diagonal gives A088218 or A001700(n-1) for n>0.
A(n+1,n) gives A048775.
Cf. A180281.

Programs

  • Maple
    A:= (n, k)-> coeff(series(((x^(k+1)-1)/(x-1))^n, x, n+1), x, n):
    seq(seq(A(n, d-n), n=0..d), d=0..12);
    # second Maple program:
    b:= proc(n, i, k) option remember; `if`(n=0, 1,
          `if`(i=0, 0, add(b(n-j, i-1, k), j=0..min(n, k))))
        end:
    A:= (n, k)-> b(n$2, k):
    seq(seq(A(n, d-n), n=0..d), d=0..12);
  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n == 0, 1, If[i == 0, 0, Sum[b[n - j, i - 1, k], {j, 0, Min[n, k]}]]];
    A[n_, k_] := b[n, n, k];
    Table[A[n, d - n], {d, 0, 12}, {n, 0, d}] // Flatten (* Jean-François Alcover, May 05 2019, after Alois P. Heinz *)

Formula

A(n,k) = [x^n] ((x^(k+1)-1)/(x-1))^n.
A(n,k) - A(n,k-1) = A180281(n,k) for n,k > 0.
A(n,k) = A(n,n) for all k >= n.

A019575 Place n distinguishable balls in n boxes (in n^n ways); let T(n,k) = number of ways that the maximum in any box is k, for 1 <= k <= n; sequence gives triangle of numbers T(n,k).

Original entry on oeis.org

1, 2, 2, 6, 18, 3, 24, 180, 48, 4, 120, 2100, 800, 100, 5, 720, 28800, 14700, 2250, 180, 6, 5040, 458640, 301350, 52920, 5292, 294, 7, 40320, 8361360, 6867840, 1342600, 153664, 10976, 448, 8, 362880, 172141200, 172872000, 36991080, 4644864, 387072, 20736, 648, 9
Offset: 1

Views

Author

Lee Corbin (lcorbin(AT)tsoft.com)

Keywords

Comments

T(n,k) is the number of endofunctions on [n] such that the maximal cardinality of the nonempty preimages equals k. - Alois P. Heinz, Jul 31 2014

Examples

			Triangle begins:
       1;
       2,         2;
       6,        18,         3;
      24,       180,        48,        4;
     120,      2100,       800,      100,       5;
     720,     28800,     14700,     2250,     180,      6;
    5040,    458640,    301350,    52920,    5292,    294,     7;
   40320,   8361360,   6867840,  1342600,  153664,  10976,   448,   8;
  362880, 172141200, 172872000, 36991080, 4644864, 387072, 20736, 648, 9;
  ...
		

Crossrefs

Cf. A019576. See A180281 for the case when the balls are indistinguishable.
Rows sums give A000312.
Cf. A245687.

Programs

  • Maple
    b:= proc(n, i, k) option remember; `if`(n=0, 1, `if`(i<1, 0,
          add(b(n-j, i-1, k)/j!, j=0..min(k, n))))
        end:
    T:= (n, k)-> n!* (b(n$2, k) -b(n$2, k-1)):
    seq(seq(T(n, k), k=1..n), n=1..12);  # Alois P. Heinz, Jul 29 2014
  • Mathematica
    f[0, , b] := Boole[b == 0]; f[n_, k_, b_] := f[n, k, b] = Sum[ Binomial[b, i]*f[n - 1, k, b - i], {i, 0, Min[k, b]}]; t[n_, k_] := f[n, k, n] - f[n, k - 1, n]; Flatten[ Table[ t[n, k], {n, 1, 9}, {k, 1, n}]] (* Jean-François Alcover, Mar 09 2012, after Robert Gerbicz *)
  • PARI
    /*setup memoization table for args <= M. Could be done dynamically inside f() */
    M=10;F=vector(M,i,vector(M,i,vector(M)));
    f(n,k,b)={ (!n||!b||!k) & return(!b); F[n][k][b] & return(F[n][k][b]);
    F[n][k][b]=sum(i=0,min(k,b),binomial(b,i)*f(n-1,k,b-i)) }
    T(n,k)=f(n,k,n)-f(n,k-1,n)
    for(n=1,9,print(vector(n,k,T(n,k))))
    \\ M. F. Hasler, Aug 19 2010; Based on Robert Gerbicz's code I suggest the following (very naively) memoized version of "f"

Formula

A019575(x, z) = Sum ( A049009(p)) where x = A036042(p), z = A049085(p) - Alford Arnold.
From Robert Gerbicz, Aug 19 2010: (Start)
Let f(n,k,b) = number of ways to place b balls to n boxes, where the max in any box is not larger than k. Then T(n,k) = f(n,k,n) - f(n,k-1,n). We have:
f(n, k, b) = if(n=0, if(b=0, 1, 0), Sum_{i=0..min(k, b)} binomial(b, i)*f(n-1, k, b-i)).
T(n,k) = f(n,k,n) - f(n,k-1,n). (End)

Extensions

Edited by N. J. A. Sloane, Sep 06 2010

A180291 Number of arrangements of n indistinguishable balls in n boxes with the maximum number of balls in any box equal to n-1.

Original entry on oeis.org

1, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306, 342, 380, 420, 462, 506, 552, 600, 650, 702, 756, 812, 870, 930, 992, 1056, 1122, 1190, 1260, 1332, 1406, 1482, 1560, 1640, 1722, 1806, 1892, 1980, 2070, 2162, 2256, 2352, 2450, 2550
Offset: 2

Views

Author

R. H. Hardin, formula from Robert Gerbicz in the Sequence Fans Mailing List, Aug 24 2010

Keywords

Comments

To clarify a slight ambiguity in the definition, the heaviest box in such an arrangement should contain exactly n-1 balls. - Gus Wiseman, Sep 22 2016
Conjecture: For n > 2, a(n) = 2*A000217(n+1). - Bruce J. Nicholson, Apr 05 2017
Clearly a(2)=1. Moreover, for n>2, a(n) = n*(n-1), since one can choose the box with n-1 balls in n ways, and the remaining ball can be put in one of the remaining n-1 boxes. So the conjecture above and the empirical formulas below are all correct. - Luca Ferrigno, Jul 13 2023
a(n) is the maximum number of squares that can be marked on an n X n bingo board without getting bingo (i.e., without completing any row, column, or diagonal). - Rasmus Lindahl, Feb 23 2025

Crossrefs

(n-1)-th entry in rows of A180281.
Essentially the same as A060798 and A002378.

Programs

  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n == 0, 1, If[i == 0, 0, Sum[b[n - j, i - 1, k], {j, 0, Min[n, k]}]]];
    a[n_] := b[n, n, n - 1] - b[n, n, n - 2];
    Table[a[n], {n, 2, 51}] (* Jean-François Alcover, Aug 28 2022, after Alois P. Heinz in A180281 *)
    a[n_] := If[n == 2, 1, n*(n - 1)] (* Luca Ferrigno, Jul 13 2023 *)

Formula

Empirical: a(n) = n*binomial(n-1,n-2) for n > 2.
Empirical: a(n) = A002378(n-1) for n > 2. - R. J. Mathar, Sep 06 2010
Empirical: a(n) = n^2 - n for n > 2. a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n > 5. G.f.: x^2*(1 + 3*x - 3*x^2 + x^3)/(1-x)^3. - Colin Barker, Mar 18 2012
a(n) = n*(n-1) for n > 2. - Luca Ferrigno, Jul 13 2023

A318160 Number of compositions of n into exactly n nonnegative parts with largest part ceiling(n/2).

Original entry on oeis.org

1, 1, 1, 6, 18, 50, 195, 392, 1652, 2970, 12825, 22022, 96030, 160888, 705341, 1162800, 5116200, 8335338, 36773397, 59366450, 262462010, 420630210, 1862790699, 2967563040, 13160496684, 20861295000, 92624149475, 146203657992, 649794035142, 1021964428880
Offset: 0

Views

Author

Alois P. Heinz, Aug 19 2018

Keywords

Examples

			a(3) = 6: 012, 021, 102, 120, 201, 210.
a(4) = 18: 0022, 0112, 0121, 0202, 0211, 0220, 1012, 1021, 1102, 1120, 1201, 1210, 2002, 2011, 2020, 2101, 2110, 2200.
a(5) = 50: 00023, 00032, 00113, 00131, 00203, 00230, 00302, 00311, 00320, 01013, 01031, 01103, 01130, 01301, 01310, 02003, 02030, 02300, 03002, 03011, 03020, 03101, 03110, 03200, 10013, 10031, 10103, 10130, 10301, 10310, 11003, 11030, 11300, 13001, 13010, 13100, 20003, 20030, 20300, 23000, 30002, 30011, 30020, 30101, 30110, 30200, 31001, 31010, 31100, 32000.
		

Crossrefs

Bisections give: A318161 (even part), A318162 (odd part).
Cf. A180281.

Programs

  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n == 0, 1, If[i == 0, 0, Sum[b[n - j, i - 1, k], {j, 0, Min[n, k]}]]];
    a[n_] := If[n == 0, 1, b[n, n, Ceiling[n/2]] - b[n, n, Ceiling[n/2] - 1]];
    Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Aug 28 2022, after Alois P. Heinz in A180281 *)

Formula

a(n) = A180281(n,ceiling(n/2)).
a(n) = 3^(3*n/2 - 7/4 + (-1)^n/4) * sqrt(n/Pi) / 2^(n - 3/2). - Vaclav Kotesovec, Sep 21 2019

A318161 Number of compositions of 2n into exactly 2n nonnegative parts with largest part n.

Original entry on oeis.org

1, 1, 18, 195, 1652, 12825, 96030, 705341, 5116200, 36773397, 262462010, 1862790699, 13160496684, 92624149475, 649794035142, 4545979700445, 31727803153232, 220975193536845, 1536191185018770, 10661898343645847, 73890140441316420, 511405029708269529
Offset: 0

Views

Author

Alois P. Heinz, Aug 19 2018

Keywords

Examples

			a(2) = 18: 0022, 0112, 0121, 0202, 0211, 0220, 1012, 1021, 1102, 1120, 1201, 1210, 2002, 2011, 2020, 2101, 2110, 2200.
		

Crossrefs

Bisection of A318160 (even part).
Cf. A180281.

Programs

  • Mathematica
    Flatten[{1, Table[n - 2*n^2 + 2*n*Binomial[3*n - 2, n], {n, 1, 20}]}] (* Vaclav Kotesovec, Sep 20 2019 *)

Formula

a(n) = A180281(2n,n).
For n>0, a(n) = n - 2*n^2 + 2*n*binomial(3*n - 2, n). - Vaclav Kotesovec, Sep 20 2019

A180282 Number of arrangements of n indistinguishable balls in n boxes with the maximum number of balls in any box equal to 2.

Original entry on oeis.org

2, 6, 18, 50, 140, 392, 1106, 3138, 8952, 25652, 73788, 212940, 616226, 1787606, 5196626, 15134930, 44152808, 128996852, 377379368, 1105350728, 3241135526, 9513228122, 27948336380, 82176836300, 241813226150, 712070156202, 2098240353906, 6186675630818
Offset: 2

Views

Author

R. H. Hardin, Aug 24 2010

Keywords

Crossrefs

Column 2 of A180281.

Programs

  • Maple
    b:= proc(n, i, k) option remember; `if`(n=0, 1,
          `if`(i=0, 0, add(b(n-j, i-1, k), j=0..min(n, k))))
        end:
    a:= n-> (k-> b(n$2, k)-b(n$2, k-1))(2):
    seq(a(n), n=2..30);  # Alois P. Heinz, Aug 17 2018
  • PARI
    for(n=2,29,print1(sum(j=1,n, binomial(n,j)*binomial(n-j,j)),", ")) \\ Hugo Pfoertner, Dec 13 2019

Formula

a(n) = Sum_{j=1..n} binomial(n,j)*binomial(n-j,j) = 2*A097861(n).
a(n) = A002426(n) - 1. - Jeppe Stig Nielsen, Dec 13 2019

A318162 Number of compositions of 2n-1 into exactly 2n-1 nonnegative parts with largest part n.

Original entry on oeis.org

1, 6, 50, 392, 2970, 22022, 160888, 1162800, 8335338, 59366450, 420630210, 2967563040, 20861295000, 146203657992, 1021964428880, 7127260128736, 49606676100234, 344658278690250, 2390849931605590, 16561583202364200, 114577083158683530, 791757148201073670
Offset: 1

Views

Author

Alois P. Heinz, Aug 19 2018

Keywords

Examples

			a(1) = 1: 1.
a(2) = 6: 012, 021, 102, 120, 201, 210.
a(3) = 50: 00023, 00032, 00113, 00131, 00203, 00230, 00302, 00311, 00320, 01013, 01031, 01103, 01130, 01301, 01310, 02003, 02030, 02300, 03002, 03011, 03020, 03101, 03110, 03200, 10013, 10031, 10103, 10130, 10301, 10310, 11003, 11030, 11300, 13001, 13010, 13100, 20003, 20030, 20300, 23000, 30002, 30011, 30020, 30101, 30110, 30200, 31001, 31010, 31100, 32000.
		

Crossrefs

Bisection of A318160 (odd part).
Cf. A180281.

Programs

  • Maple
    a:= proc(n) option remember; (2*n-1)*`if`(n<3, n,
          3*(3*n-4)*(3*n-5)*a(n-1)/(2*(n-1)*(2*n-3)^2))
        end:
    seq(a(n), n=1..30);
  • Mathematica
    Flatten[{1, Table[2*(2*n - 1)*Binomial[3*n - 4, n-2], {n, 2, 20}]}] (* Vaclav Kotesovec, Sep 20 2019 *)

Formula

a(n) = A180281(2n-1,n).
For n>1, a(n) = 2*(2*n - 1) * binomial(3*n - 4, n-2). - Vaclav Kotesovec, Sep 20 2019

A180283 Number of arrangements of n indistinguishable balls in n boxes with the maximum number of balls in any box equal to 3.

Original entry on oeis.org

3, 12, 50, 195, 735, 2716, 9912, 35850, 128865, 461175, 1645215, 5855941, 20810153, 73870748, 262029364, 929031504, 3293120337, 11672207262, 41373395052, 146674116501, 520093043437, 1844704839175, 6544970763175, 23229252652125
Offset: 3

Views

Author

R. H. Hardin, Aug 24 2010

Keywords

Crossrefs

Column 3 of A180281.

Programs

  • Maple
    f:= proc(m,n) option remember;
      if m > 3*n or m < 3 then return 0 fi;
      g(m-3,n-1) + add(procname(m-i,n-1),i=0..2)
    end proc:
    g:= proc(m,n) option remember;
      if m > 3*n then return 0 fi;
      add(procname(m-i,n-1), i=0..min(m,3))
    end proc:
    g(0,0):= 1:
    seq(f(n,n),n=3..30); # Robert Israel, May 03 2018
  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n == 0, 1, If[i == 0, 0, Sum[b[n-j, i-1, k], {j, 0, Min[n, k]}]]];
    a[n_] := b[n, n, 3] - b[n, n, 2];
    Table[a[n], {n, 3, 30}] (* Jean-François Alcover, Aug 28 2022, after Alois P. Heinz in A180281 *)

A180284 Number of arrangements of n indistinguishable balls in n boxes with the maximum number of balls in any box equal to 4.

Original entry on oeis.org

4, 20, 90, 392, 1652, 6804, 27600, 110715, 440374, 1740024, 6838832, 26762645, 104356980, 405706292, 1573256772, 6087597150, 23511579564, 90659983064, 349090305487, 1342531370565, 5157512878694, 19794331541270, 75905591609120, 290857683782250, 1113774550930080
Offset: 4

Views

Author

R. H. Hardin, Aug 24 2010

Keywords

Crossrefs

Column 4 of A180281.

Programs

  • Maple
    b:= proc(n, i, k) option remember; `if`(n=0, 1,
          `if`(i=0, 0, add(b(n-j, i-1, k), j=0..min(n, k))))
        end:
    a:= n-> (k-> b(n$2, k)-b(n$2, k-1))(4):
    seq(a(n), n=4..30);  # Alois P. Heinz, Aug 17 2018
  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n == 0, 1, If[i == 0, 0, Sum[b[n - j, i - 1, k], {j, 0, Min[n, k]}]]];
    a[n_] := If[n == 0, 1, b[n, n, 4] - b[n, n, 3]];
    Table[a[n], {n, 4, 30}] (* Jean-François Alcover, Aug 28 2022, after Maple program *)

A180285 Number of arrangements of n indistinguishable balls in n boxes with the maximum number of balls in any box equal to 5.

Original entry on oeis.org

5, 30, 147, 672, 2970, 12825, 54450, 228294, 948090, 3907995, 16011905, 65280800, 265055772, 1072443810, 4326290424, 17407489065, 69884197635, 280002750720, 1119913829375, 4472279679846, 17834705765630, 71032337773930, 282586675707180, 1123047360182475
Offset: 5

Views

Author

R. H. Hardin, Aug 24 2010

Keywords

Crossrefs

Column 5 of A180281.

Programs

  • Maple
    b:= proc(n, i, k) option remember; `if`(n=0, 1,
          `if`(i=0, 0, add(b(n-j, i-1, k), j=0..min(n, k))))
        end:
    a:= n-> (k-> b(n$2, k)-b(n$2, k-1))(5):
    seq(a(n), n=5..30);  # Alois P. Heinz, Aug 17 2018
Showing 1-10 of 24 results. Next