Solution (source code)

= Solution

Put $v_k=p_k(1-p_k)$ and assume $0<p_k<1$. For fixed $n$ and a fixed nonzero difference $\Delta=p_0-p_1$, the approximate <statistical power> of the <Wald test> increases as its noncentrality $|\Delta|/\sqrt V$ increases, where
$$
V=\frac{v_0}{n_0}+\frac{v_1}{n-n_0}.
$$
Differentiating with respect to the continuous allocation gives
$$
\frac{dV}{dn_0}=-\frac{v_0}{n_0^2}+\frac{v_1}{n_1^2}=0,\qquad
\frac{d^2V}{dn_0^2}=\frac{2v_0}{n_0^3}+\frac{2v_1}{n_1^3}>0.
$$
Hence the unique minimum and its associated minimum <variance> are
$$
\boxed{R^*=\frac{n_0}{n_1}=\sqrt{\frac{p_0(1-p_0)}{p_1(1-p_1)}},\qquad
V_{\min}=\frac{(\sqrt{v_0}+\sqrt{v_1})^2}{n}.}
$$
This is <Neyman allocation>. Integer allocations use a feasible adjacent integer to the continuous optimum, comparing the resulting <variances>; $n_0,n_1\geq1$ must still hold. It is a large-sample <normal approximation> argument, not an exact finite-sample power theorem for arbitrary <response-adaptive randomization>. Under the null $p_0=p_1$, the approximate power is the <significance level> for any allocation, although the same allocation still minimizes the stated <variance>.