Expected number of draws to draw 3 of the same balls out of an urn with replacement 
An urn contains twelve balls numbered 1 to 12. We draw a ball, record its
  number, and replace it in the urn. We repeat this until we draw any
  number three times. What is the expected number of draws?

First post here. Anyhow, I can solve the variant with one repeat, but I am struggling to figure out how to solve it with two repeats.
My initial guess was to use a Geometric distribution with $E[X] = 1/p$, where $p = P(\text{three balls are} 1)+...+P(\text{three balls are} 12) = 12*(1/12^3)$. So $1/(12*(1/12^3)) = 144$.
It seemed a bit high, and I realized that this only works if we are drawing three at a time. Been stumped for a few hours now. I think I am overthinking this. Can anyone help?
 A: Here is an approximate approach.  If you make $n$ draws we will first consider the chance you have gotten at least three $1$s.  We use a Poisson distribution to compute the probability with parameter $\lambda=\frac n{12}$.  This is probably close, though $\frac 1{12}$ is not really small.  The chance that you have exactly three $1$s is $\frac {\lambda ^3 e^{-\lambda}}{3!}$.  Now we consider the chance of getting three of one number independent of the chance of getting three of another.  If you know you did or didn't get three of one number that doesn't change the number of tries to get three of another very much.  Intuitively, we want the chance of getting three of a specific number to be about $\frac 1{12}$.  If we make twelve draws with a chance of $\frac 1{12}$ for each one, we have $\frac 1e \approx 0.368$ of failing on all of them, so about $0.632$ chance of getting at least one.  We can solve for $\lambda$ in $$\frac {\lambda ^3 e^{-\lambda}}{3!}=\frac 1{12}\\\lambda \approx 1.17374\\n\approx 14$$ which seems amazingly small to me.  I wrote a little program to simulate this using Python's random number generator and the average $n$ came out just below $11$, supporting the calculation.  I was surprised how small it was.
A: Let's say the first time we have drawn the same number three times is on draw number $X$, so we want to find $E(X)$.  Our approach is to find $P(X>n)$ for $n=0,1,2, \dots ,24$, and then apply the theorem $E(X) = \sum_{n>0} P(X>n)$.
$X>n$ if no number has been drawn more then two times by the $n$th draw.  There are $12^n$ possible sequences of numbers in $n$ draws, all of which we assume are equally likely.  We would like to count the sequences in which no number occurs more than twice; let's say this number is $a_n$.  The exponential generating function for $a_n$ is
$$\begin{align}
f(x) &= \left( 1+x+\frac{1}{2}x^2 \right)^{12} \\
&= \left[ (1+x)+\frac{1}{2}x^2 \right]^{12} \\
&= \sum_{i=0}^{12} \binom{12}{i} (1+x)^i \left( \frac{1}{2} x^2 \right)^{12-i} \\
&= \sum_{i=0}^{12} \binom{12}{i} \left( \frac{1}{2} \right)^{12-i} x^{24-2i} \sum_{j=0}^i \binom{i}{j} x^j \\
&= \sum_{i=0}^{12} \sum_{j=0}^i \binom{12}{i} \left( \frac{1}{2} \right)^{12-i} \binom{i}{j} x^{24-2i+j}
\end{align}$$
where we have applied the binomial theorem twice above. 
So $a_n$ is the coefficient of $(1/n!) x^n$ in $f(x)$:
$$a_n = n! \sum_{i=12-\lfloor n/2 \rfloor}^{12} \binom{12}{i} \left( \frac{1}{2} \right)^{12-i} \binom{i}{n-24+2i}$$
for $n=0,1,2, \dots ,24$,
and $$P(X>n) = \frac{a_n}{12^n}$$
Finally, $$E(X) = \sum_{n=0}^{24} P(X>n) \approx 10.7821$$
which is in agreement with the Monte Carlo estimate given in a comment by Suzuteo.
