How to distinguish between two biased coins I have two very biased coins:

*

*The first coin (C1) lands on heads 95% of the time.

*The second coin (C2) lands on heads only 1% of the time.

One of the coins has been selected and I want to determine which coin that is.  I can toss the coin as many times as possible and record a series of heads and tails results.
Let's say I want to know with 99.99% confidence, and as soon as possible, which coin is being flipped. How can I do so?
I would like to flip the coin, and after each result either continue or make a decision on which coin I have. I don't need to know how many times to flip before I start.
(Sorry if this is a very basic question that has been asked before. I lack the vocab to know how to search for this problem).
 A: Say the odds of getting $C_1$ over $C_2$ are, in principle, $1:1$. Then, you flip the coin $n$ times and get $x$ heads. If we call the probabilities of heads $p_1=0.95$ and $p_2=0.01$, then the probability that each coin gives $x$ heads is:
$$P(x|C_1)=p_1^x(1-p_1)^{n-x}$$
$$P(x|C_2)=p_2^x(1-p_2)^{n-x}$$
If we use Bayes theorem, we get the odds that the coin is $C_1$ including the information from the coin tosses:
$$\begin{align}
\frac{P(C_1|x)}{P(C_2|x)}&=\frac{P(C_1)\cdot p_1^x(1-p_1)^{n-x}}{P(C_2)\cdot p_2^x(1-p_2)^{n-x}}\\
&=\frac{p_1^x(1-p_1)^{n-x}}{p_2^x(1-p_2)^{n-x}}\\
&=\left(\frac{p_1}{p_2}\right)^x\left(\frac{1-p_1}{1-p_2}\right)^{n-x}
\end{align}$$
For example, if you tossed the coin 3 times and had 2 heads, you would have:
$$\frac{P(C_1|x)}{P(C_2|x)}=\left(\frac{0.95}{0.01}\right)^{2}\left(\frac{0.05}{0.99}\right)^{1}\approx456$$
That means the odds that the coin is $C_1$ are $456:1$, which is equivalent to a probability of $\frac{456}{456+1}\approx99.8\%$. That looks like a huge value for such a low number of trials, and the reason is that the probabilities $95\%$ and $1\%$ are very different. If the coins had closer probabilities, the odds would not be so dramatic.
