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

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

A241581 Row sums in triangle A241580.

Original entry on oeis.org

1, 1, 8, 54, 584, 7350, 114162, 2053688, 42513984, 991883610, 25807006730, 740614555692, 23250961252752, 792694751381078, 29169262097277330, 1152329533163353680, 48645406703597457152, 2185462919071085059890, 104113841197940277430554, 5242449827954998459195220
Offset: 1

Views

Author

N. J. A. Sloane, Apr 29 2014

Keywords

Crossrefs

Programs

  • Maple
    M:=20;
    T[1,1]:=1:
    for n from 2 to M do
       T[n,n]:=(n-1)^(n-1);
       for k from n-1 by -1 to 1 do
          T[n,k]:=T[n,k+1]-(n-1)*T[n-1,k]:
    od:
    od:
    f:=n->(n^n-T[n+1,1])/n;[seq(f(n),n=1..M-1)];

Formula

a(n) = (n^n-A241580(n+1,1))/n.
a(n) = A245687(n,1)/n. - Alois P. Heinz, Jul 29 2014

A273325 Number of endofunctions on [2n] such that the minimal cardinality of the nonempty preimages equals n.

Original entry on oeis.org

1, 2, 36, 300, 1960, 11340, 60984, 312312, 1544400, 7438860, 35103640, 162954792, 746347056, 3380195000, 15164074800, 67476121200, 298135873440, 1309153089420, 5717335239000, 24847720451400, 107520292479600, 463440029892840, 1990477619679120, 8521600803066000
Offset: 0

Views

Author

Alois P. Heinz, May 20 2016

Keywords

Comments

a(0) = 1 by convention.

Examples

			a(1) = 2: 12, 21.
a(2) = 36: 1122, 1133, 1144, 1212, 1221, 1313, 1331, 1414, 1441, 2112, 2121, 2211, 2233, 2244, 2323, 2332, 2424, 2442, 3113, 3131, 3223, 3232, 3311, 3322, 3344, 3434, 3443, 4114, 4141, 4224, 4242, 4334, 4343, 4411, 4422, 4433.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, 2^n,
           2*(2*n-1)^2*a(n-1)/((n-1)*(2*n-3)))
        end:
    seq(a(n), n=0..30);
  • Mathematica
    a[n_] := (2*n^3 + n^2 - n) * CatalanNumber[n]; a[0] = 1; Array[a, 30, 0] (* Amiram Eldar, Mar 12 2023 *)

Formula

G.f.: 1+(8*x+1)*2*x/(1-4*x)^(5/2).
a(n) = C(2*n,n)*C(2*n,2) for n>0, a(0)=1.
a(n) = 2*C(2*(n-1),n-1)*(2*n-1)^2, a(0)=1.
a(n) = 2*(2*n-1)^2*a(n-1)/((n-1)*(2*n-3)) for n>1, a(n) = 2^n for n=0..1.
a(n) = A245687(2n,n).
a(n) = A000108(n)*A213820(n) = 2*A000108(n)*A002414(n) for n>0, a(0)=1.
Sum_{n>=0} 1/a(n) = 1 - log(sqrt(3)+2)*Pi/6 + 4*G/3, where G is Catalan's constant (A006752). - Amiram Eldar, Mar 12 2023
Showing 1-3 of 3 results.