How to determine the number of coin tosses to identify one biased coin from another? If coin $X$ and coin $Y$ are biased, and have the probability of turning up heads at $p$ and $q$ respectively, then given one of these coins at random, how many times must coin A be flipped in order to identify whether we're dealing with coin $X$ or $Y$? We assume a 0.5 chance that we can get either coin.

We should find the percentage of heads that is equally probable for both coins, let that be $m\in(0,1)$ Let say $p<m<q$. So we have:
$$p^m(1-p)^{1-m}=q^m(1-q)^{1-m}\\
(\frac p q)^m(\frac {1-p}{1-q})^{1-m}=1\\
(\frac {p(1-q)} {q(1-p)})^m=\frac {1-q}{1-p}\\
m=\log_{\frac {p(1-q)} {q(1-p)}}\frac {1-q}{1-p}$$
We are looking for such $n$ that probability that number of heads is bellow $mn$ when you picked X, is for $P$ larger than same probability if you picked Y. Where $P$ is the wanted accuracy for claiming which coin it is.
$p_n(k<mn|X)-p_n(k<mn|Y)>P$ Which also implies $p_n(k>mn|Y)-p_n(k>mn|X)>P$
For finding $p_n(k<mn|X)$ we can use approximation to standard Normal distribution, it will be 
$$\Phi(\sqrt n\frac{m-p}{\sqrt{p(1-p)}})-\Phi(\sqrt n\frac{m-q}{\sqrt{q(1-q)}})>P$$
So problem becomes: find $x$ such that $\Phi(ax)-\Phi(bx)>P$ where $a,b,P$ are known
