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
Lee Corbin (lcorbin(AT)tsoft.com)
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;
...
Cf.
A019576. See
A180281 for the case when the balls are indistinguishable.
-
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
-
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 *)
-
/*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"
A019577
Place n distinguishable balls in n boxes (in n^n ways); let f(n,k) = number of ways that max in any box is k, for 1<=k<=n; sequence gives f(n,2)/n.
Original entry on oeis.org
0, 1, 6, 45, 420, 4800, 65520, 1045170, 19126800, 395448480, 9120988800, 232248416400, 6471820555200, 195912193276800, 6402199349145600, 224636583525354000, 8423131243022496000, 336138596955120960000, 14224375944427993344000, 636224790017466730080000
Offset: 1
A019579
Place n distinguishable balls in n boxes (in n^n ways); let f(n,k) = number of ways that max in any box is k, for 1 <= k <= n; sequence gives f(n,n-2)/n.
Original entry on oeis.org
2, 45, 160, 375, 756, 1372, 2304, 3645, 5500, 7986, 11232, 15379, 20580, 27000, 34816, 44217, 55404, 68590, 84000, 101871, 122452, 146004, 172800, 203125, 237276, 275562, 318304, 365835, 418500, 476656, 540672, 610929, 687820, 771750, 863136, 962407
Offset: 3
-
CoefficientList[Series[-(9 x^6 - 35 x^5 + 41 x^4 + 5 x^3 - 45 x^2 + 35 x + 2)/(x - 1)^5, {x, 0, 50}], x] (* Vincenzo Librandi, Oct 16 2013 *)
LinearRecurrence[{5,-10,10,-5,1},{2,45,160,375,756,1372,2304},40] (* Harvey P. Dale, Dec 18 2020 *)
A019581
Place n distinguishable balls in n boxes (in n^n ways); let f(n,k) = number of ways that max in any box is k, for 1<=k<=n; sequence gives f(n,2).
Original entry on oeis.org
0, 2, 18, 180, 2100, 28800, 458640, 8361360, 172141200, 3954484800, 100330876800, 2786980996800, 84133667217600, 2742770705875200, 96032990237184000, 3594185336405664000, 143193231131382432000, 6050494745192177280000, 270263142944131873536000
Offset: 1
-
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
add(b(n-j, i-1)/j!, j=0..min(2, n))))
end:
a:= n-> n! *(b(n$2) -1):
seq(a(n), n=1..30); # Alois P. Heinz, Jul 29 2014
-
a[n_] := n! (Hypergeometric2F1[1/2 - n/2, -n/2, 1, 2] - 1); Array[a, 30] (* Jean-François Alcover, Feb 18 2016 *)
-
a(n) = sum(d=1, n\2, n!^2 / (2^d * (n-2*d)! * d!^2)); \\ Michel Marcus, Aug 13 2013
A019578
Place n distinguishable balls in n boxes (in n^n ways); let f(n,k) = number of ways that max in any box is k, for 1<=k<=n; sequence gives f(n,3)/n.
Original entry on oeis.org
1, 12, 160, 2450, 43050, 858480, 19208000, 477237600, 13049190000, 389642022000, 12620614406400, 440871877446000, 16525943429595600, 661779275661504000, 28199857953915648000, 1274233240573028736000, 60863881753459328544000
Offset: 3
Lee Corbin (lcorbin(AT)tsoft.com)
A019580
Place n distinguishable balls in n boxes (in n^n ways); let f(n,k) = number of ways that max in any box is k, for 1<=k<=n; sequence gives f(n,4)/n.
Original entry on oeis.org
1, 20, 375, 7560, 167825, 4110120, 110602800, 3252075750, 103881924300, 3585467886000, 133052005386300, 5284678706307000, 223761183682286250, 10063370411081988000, 479152851159102120000, 24082014064135799772000
Offset: 4
Lee Corbin (lcorbin(AT)tsoft.com)
Showing 1-6 of 6 results.
Comments