TITLE: Searching for tagged balls under constraints
QUESTION [8 upvotes]: (This is a modification of this problem.)
You have $k$ white balls and $k$ black balls, and know that exactly one of each color is radioactive.  You can place any number of balls of your choosing in a radiation detector that reveals only whether $0$, $1$ or $2$ measured balls are radioactive.
Specify an algorithm that identifies the two radioactive balls in as few such measurements as possible in the worst case.

Some thoughts:
The total uncertainty in the initial system, in bits, is $\log_2 k + \log_2 k = 2 \log_2 k = \log_2 k^2$.
(Sparked by a comment by @leonbloy.) The selection is a Bernoulli process and the most information one can obtain is $3/2$ bits.  Thus in principle the total number of needed measurements is bounded by:
$$\left\lceil \frac{2\log_2 k}{3/2}\right \rceil.$$
Here is a decision tree for the small case $k=2$.  We label the balls $b_1, b_2, w_1, w_2$ and first measure $b_1$ with $w_1$.  (I'm pretty sure that testing one black and one white provides the maximum information.)  The arcs denote the output of the measurement.  In the case of $0$ or $2$ detected radioactive balls, we are done and the red boxed leafs are our answers.
If the result is $1$, we then measure $b_1 w_2$ which can only give a $0$ or $2$ output, and our final conclusions are shown at the bottom leafs.

The expected number of measurements is ${\cal E}[m] = \frac{1}{2} \cdot 1 + \frac{1}{2} \cdot 2 = 1.5$.
Of course there are other ways to guarantee an answer in two measurements, for instance one measurement on a single black, then one measurement on a single white.  But that algorithm guarantees you will need two measurements, i.e, ${\cal E}[m] = 2$.  (Admittedly, both algorithms have the same worst case performance.) The decision tree above gives you an answer half of the time with just a single measurement--it exploits more from the three-way answer than would a two-way answer.
(I have a feeling this problem has been solved in the literature, but I couldn't find it on SE nor with a cursory search online.)

REPLY [2 votes]: The following algorithm finds both radioactive balls in $\mathcal O(\log_\phi k)=\mathcal O(1.44\log_2 k)$ tests, at worst. Each test eliminates $2/1.44\approx 1.39$ bits of uncertainty on average.
Assume first that $k=F_n$ is a Fibonacci number. Let $S_n$ be the state where there are $F_n$ white balls and $F_n$ black balls which could be radioactive. 
If you are in the state $S_n$, test $F_{n-1}$ black balls and $F_{n-1}$ white balls. 

If there are two radioactive balls, we move to state $S_{n-1}$. 
If there are zero radioactive balls, we move to state $S_{n-2}$. 
If there is one radioactive ball, then there are $2 \times F_{n-1}\times F_{n-2}$ possibilities. The white balls and black balls are partitioned into sets of size $F_{n-1}$ and $F_{n-2}$ so that one color has its radioactive ball in the large set, and the other has its radioactive ball in the small set. Call this state $T_{n-1}$.

Suppose you are in state $T_{n}$, so the white ball and black  balls are in two parts of size $F_n$ and $F_{n-1}$, so that one radioactive ball is in a large part an the other is in a small part. Test $F_{n-1}$ white balls from the large part, all the black balls from the small part, and $F_{n-2}$ black balls from the large part (see diagram for a good visualization). 

If there are two radioactive balls, we move to state $S_{n-1}$.
If there are zero radioactive balls, we move to state $S_{n-1}$. 
If there is one radioactive ball, we move to state $T_{n-1}$. 

We start in state $S_n$, and from $S_k$ or $T_k$ we move to either $S_{k-1}$ or $T_{k-1}$ at worst. Therefore, after at most $n-2$ tests, we will be in either $S_2$, in which case we are done, or $T_2$, in which case one more test suffices. Therefore, we can solve $k=F_n$ in at most $n-1$ tests. 
In general, if $k$ is not a Fibonacci number, then we can add "dummy" balls to make it a Fibonacci number, so $n-1$ tests suffice where $n$ is the smallest integer so $F_n\ge k$. 
Using the approximation $F_n\approx \frac1{\sqrt 5}\phi^n$, we can compute the worst case number of tests as a function of $k$ almost exactly:
\begin{align}
F_{n-1}<k\le F_n 
  &\implies \frac1{\sqrt5}\phi^{n-1}\lesssim k\lesssim\frac1{\sqrt5}\phi^{n} 
\\&\implies \log_\phi(k\sqrt{5})\lesssim n\lesssim \log_\phi(k\sqrt{5})+1
\\&\implies n \approx \Big\lceil \log_\phi k+\log_\phi\sqrt{5}\Big\rceil
\\&\implies \text{# tests}=n-1 \approx \Big\lceil \log_\phi k+0.672\Big\rceil
\end{align}