This problem is quite simple combinatorially but finding closed forms
is difficult, indeed the intermediate results indicate there may not
be any. Suppose we treat the case of $n$ coupons where we wait until
some coupon has been seen $n-1$ times. We have from first principles
that the probability for this to happen after $m$ draws is given by
$$P[T=m] = \frac{1}{n^m}
(m-1)! [z^{m-1}] \frac{d}{du}
\left.\left(\sum_{q=0}^{n-3} \frac{z^q}{q!} + u\frac{z^{n-2}}{(n-2)!}
\right)^n\right|_{u=1}.$$
This is
$$P[T=m] = \frac{n}{n^m}
(m-1)! [z^{m-1}] \frac{z^{n-2}}{(n-2)!}
\left(\sum_{q=0}^{n-2} \frac{z^q}{q!}\right)^{n-1}.$$
We can now compute the expectation as follows.
F := n -> z^(n-2)/(n-2)!*add(z^q/q!, q=0..n-2)^(n-1);
X :=
proc(n)
local FF;
option remember;
FF := expand(F(n));
add(m*n/n^m*(m-1)!*coeff(FF, z, m-1), m=n-1..1+(n-2)*n);
end;
For $n=9$ we thus obtain
> X(9);
96899089924114484187946852578422805520046700098386996168
--------------------------------------------------------
2465034704958067503996131453373943813074726512397600969
> evalf(%);
39.30942219
The form of this result indicates there may not be a simple answer. If
there were any possibility of potential cancellation it would have
appeared at this point.
Code.
#include
#include
#include
#include
#include
int main(int argc, char **argv)
{
int n = 6, trials = 1000;
if(argc >= 2){
n = atoi(argv[1]);
}
if(argc >= 3){
trials = atoi(argv[2]);
}
assert(1 <= n);
assert(1 <= trials);
srand48(time(NULL));
long long data = 0;
for(int tind = 0; tind < trials; tind++){
int dist[n]; int steps = 0;
for(int cind = 0; cind < n; cind++){
dist[cind] = 0;
}
while(1){
int coupon = drand48() * (double)n;
steps++;
if(dist[coupon] == n-2)
break;
dist[coupon]++;
}
data += steps;
}
long double expt = (long double)data/(long double)trials;
printf("[n = %d, trials = %d]: %Le\n",
n, trials, expt);
exit(0);
}