TITLE: Probability of drawing a run of a specific color from an urn with two colors of balls
QUESTION [6 upvotes]: I was sent a puzzle involving an urn with 128 white balls and 288 black. If the balls are drawn without replacement until the urn is exhausted, what is the probability that a sequence of 10 or more consecutive white balls will be drawn?
I solved this algorithmically using recursion and arrived at ~0.00170843. Simulations match this result well.
Is there a more direct conbinatorial method to answer this kind of question?

REPLY [3 votes]: Suppose that we have $w$ white balls and $b$ black balls, and 
that they are placed in a random order. Define the  indices
with black balls to be  $1\leq i_1<i_2<\cdots < i_b\leq w+b$. 
We define the gaps between the black balls to be 
$$g_1=i_1, \quad g_j=i_j-i_{j-1} \mbox{ for }2\leq j\leq b,\quad  \mbox{ and }\ g_{b+1}=(b+w+1)-i_b.$$
Note that these gaps form a composition of the integer $b+w+1$
 into $b+1$ parts, and that there is a one-to-one correspondence
 between random ordering of the colors and such compositions.
For example, if $w=3$ and $b=2$ then the order
 $BWWBW$ corresponds to the composition $1+3+2$ of $6$ into $3$ parts.
In general, $g_1+g_2+\cdots +g_{b+1}=b+w+1.$
Now those orders where the runs of white balls all have size less than  $m$ 
are exactly those where the black gaps are at most $m$.
But we can count these with the same formula that tells 
us how many ways we can roll $b+1$  dice with $m$ sides and 
get a total of $b+w+1$, i.e.,
$$S:=\sum_{j=0}^{\lfloor w/m\rfloor} (-1)^j {b+1\choose j}{w+b-jm\choose b}.$$
The required probability of at least one run of $m$ or more 
consecutive white balls is $$P=1-{S\over {b+w\choose b}}.$$
For $w=128$, $b=288$, and $m=10$ this gives $P=.001708427151$.