# Radioactive coins - find the two radioactive coins out of twelve

Here is a beautiful problem:

Given twelve coins, exactly two of them is radioactive. There is a machine. You are able to put some of the coins into the machine, and then the machine tells if the coins contain a radioactive one. It doesn’t tell exactly how many, only if there is at least one. How many tries do you need to find the two radioactive coins.

Of course is it easily possible with 12 or 11 tries. But what is the minimum number of tries needed to find the two radioactive coins? And what if there are $$n$$ coins, where two of them are radioactive? Then is it possible to find the minimum number of tries?

• I think the best way is something like binary search. Then number of tries is $\ln{n}$. Commented Nov 24, 2018 at 23:27
• At least $7$ trials are required. There are $66$ possibilities for the two distinguished coins. Since the machine only answers "yes" or "no", we can model the decision process as a binary tree, which must have at least $66$ leaves. If there are $k$ tests, we can have at most $2^k$ leaves, so $k\ge 7.$ I haven't come up with a way to do it in $7$ tests yet, however. Commented Nov 24, 2018 at 23:33

Here is a way to find the coins in no more than 7 tests.

Number the coins 1 through 12. Then test the following 3 groups of coins:

[1,2,3,4], [5,6,7,8], [9,10,11,12]

That takes at most 3 tests. Then consider two cases.

• Case 1: If only of those groups, say [1,2,3,4], tests positive then it contains both radioactive coins, In that case test three of its coins, say 1, 2, and 3. If two of those coins test positive then we are done. If only one tests positive, the other one is 4. This requires three additional tests, so 3 + 3 = 6 tests total.

• Case 2: If two of the original groups test positive, say [1,2,3,4] and [6,7,8,9], then we know one of the coins is in one of the groups and the other one is in the other one. Then perform binary search on each of them. That takes 2 additional tests per group, so a total of 4 tests, plus the original 3 tests = 7 tests.

As saulspatz noted, there are 66 possibilities and the process work like a binary decision tree with at most $$2^k$$ leaves, so $$k\geq 7$$. Hence the process shown above is optimal.

• Is this similar to the “12 balls with 2 heavier/lighter” puzzle? Commented Nov 25, 2018 at 14:14
• @user107224 - depends on your definition of "similar", but a major difference is that a scale/balance has 3 outcomes: left side heavier, right side heavier, equal. so the detailed math bounds & algorithms are different. however, certainly the same kind of thinking goes into solving both. Commented Dec 12, 2018 at 16:43