Here’s a puzzle I saw a long time ago that came to mind recently.

You have a bag of 27 coins. One of these coins is counterfeit and the rest are genuine. The genuine coins all weigh exactly the same, but the counterfeit coin is lighter. You have a simple balance. How can you find the counterfeit coin while using the scale the least number of times?

The surprising answer is that the false coin can be found while only using the scales only three times. Here’s how. Put nine coins on each side of the balance. If one side is lighter, the counterfeit is on that side; otherwise, it is one of the nine not on the scales. Now that you’ve narrowed it down to nine coins, apply the same idea recursively by putting three of the suspect coins on each side of the balance. The false coin is now either on the lighter side if the scales do not balance or one of the three remaining coins if the scales do balance. Now apply the same idea one last time to find which of the remaining three coins is the counterfeit. In general, you can find one counterfeit in 3^{n} coins by using the scales *n* times.

The counterfeit coin problem came to mind when I was picking out homework problems for a probability class and ran into the following (problem 4.56 here):

A large number, *N = mk*, of people are subject to a blood test. This can be administered in two ways.

- Each person can be tested separately. In this case
*N* tests are required.
- The blood samples of
*k* people can be pooled and analyzed together. If the test is negative, this *one* test suffices for *k* people. If the test is positive, each of the *k* people must be tested separately, and, in all, *k+1* test are required for the *k* people.

Suppose each person being tested has the disease with probability *p*. If the disease is rare, i.e. *p* is sufficiently small, the second approach will be more efficient. Consider the extremes. If *p* = 0, the first approach takes *mk* tests and the second approach takes only *m* tests. At the other extreme, if *p* = 1, the first approach still takes *mk* tests but the second approach now takes *m(k+1)* tests.

The homework problem asks for the expected number of tests used with each approach as a function of *p* for fixed *k*. Alternatively, you could assume that you always use the second method but need to find the optimal value of *k*. (This includes the possibility that *k*=1, which is equivalent to using the first method.)

I’d be curious to know whether these algorithms have names. I suspect computer scientists have given the coin testing algorithm a name. I also suspect the idea of pooling blood samples has several names, possibly one name when it is used in literally testing blood samples and other names when the same idea is applied to analogous testing problems.

* * *

For daily posts on probability, follow @ProbFact on Twitter.