This problem came up in a game I was playing. It's surely a standard combinatorics problem, but I'm having trouble searching for an exact match.
Suppose an urn contains $B$ blue balls, $R$ red balls, and $G$ green balls. Balls are drawn without replacement until you've drawn three balls of any one color (not necessarily consecutively). What's the probability of ending with three blue balls?
My reasoning is as follows: the number of ways to stop after drawing three blue balls is equal to the number of ways of drawing exactly two blue and at most two red and green balls (in any order), times the number of blue balls ending the sequence. This suggests that the number of ways of ending with blue is
$$E_B = \sum_{i=0}^2 \sum_{j=0}^2 (B-2)(2+i+j)!\binom{B}{2}\binom{R}{i}\binom{G}{j}$$
where the binomial terms select which balls are drawn and the factorial enumerates all permutations, for the sequence of balls excluding the last ball. The probability of ending with three blue balls is then $$\frac{E_B}{E_B+E_R+E_G}$$ for $E_R$ and $E_G$ computed analogously.
Is this approach correct?
EDIT: Proposed recursive solutions to the problem (e.g. Blatter's answer below) are practical if one just cares about computing a number, but I'm particularly interested in an answer to this question that 1) explains why the above formula is incorrect, and 2) salvages the formula.
The following is a full solution of the problem, but the final formula gives no insight.
Note that the game ends after at most $7$ moves. It is played on the vertices and grid lines of the lattice cube $[0..2]^3$, hence has $27$ nonterminal states.
Denote by $p(x,y,z)$ the probability that the game ends with three drawn blue balls, given that we already have drawn $x$ blue, $y$ red, and $z$ green balls. This function satisfies $$p(3,y,z)=1,\quad p(x,3,z)=0,\quad p(x,y,3)=0\qquad \bigl(x,\>y,\>z\in[0..2]\bigr)$$ and the backwards recursion $$p(x,y,z)={b-x\over n-j}\>p(x+1,y,z)+{r-y\over n-j}\>p(x,y+1,z)+{g-z\over n-j}\>p(x,y,z+1)\ ,$$ whereby $n:=b+r+g$ and $j:=x+y+z$.
The quantity $t:=p(0,0,0)$ then is the probability you are looking for. Here is a Mathematica implementation of this approach, together with a numerical example: