You have 8 identical looking rods, 2 of which are radioactive, though you don't know which. You also have a box which can test for radioactivity, which can hold any number of rods. After the test, the box will indicate whether or not at least one of the rods inside were radioactive.

What is the fewest number of tests it takes to determine the radioactive pair?

  • 1
    $\begingroup$ Fewest on average or worst case? $\endgroup$
    – DanielST
    Commented Jul 31, 2015 at 17:47

6 Answers 6


In the worst-case scenario, it requires

six tests

to locate the radioactive rods. Several answers already describe strategies for locating the radioactive rods. I will give another.

Testing strategy: Start by testing two rods. If neither of these rods is radioactive, use the five remaining tests on five of the six remaining rods, one at a time. If two of these rods are radioactive, we are done. If only one is radioactive, then the single untested rod must also be radioactive.

If the first test indicates at least one of the two rods is radioactive, then divide the remaining six rods into two groups of three, and test both groups. If neither group contains a radioactive rod, then the initial two rods tested must both be radioactive. If one of the two groups of three is radiactive, we will use our final three test on a single rod each, one rod from the initial group of two, and two rods from the group of three containing a radioactive rod. Each of these groups has exactly one radioactive rod, so testing all but one of the rods (one at a time) is enough to determine which rod in each group is radioactive.

Proof that this cannot be done with fewer tests: Suppose we have a strategy that is guaranteed to find the radioactive rods with five tests. The first test will involve $k$ rods. Initially, there are ${8\choose 2}=28$ possibilities for the pair of radioactive rods. After the first measurement, there will be either $28-{8-k\choose 2}$ possibilities (if at least one of the tested rods is radioactive), or ${8-k\choose 2}$ possibilities (if none of the tested rods is radioactive). Only four tests will then remain, so we can only distinguish between $2^4=16$ possibilities. This means we need $28-{8-k\choose 2}\leq 16$ and ${8-k\choose 2}\leq 16$. Direct computation shows that this is only satisfied for $k=2$, so our strategy must start by testing exactly two rods.

Suppose that neither of the two rods we test first is radioactive. Our next test will involve $j$ of the remaining rods. At this point, there are ${6\choose 2}=15$ possibilities for the pair of radioactive rods. After the second test, the number of possibilities will either be $15-{6-j\choose 2}$ or ${6-j\choose 2}$. After this test, we will only have three tests remaining, so we need $15-{6-j\choose 2}\leq 8$ and ${6-j\choose 2}\leq 8$. There is no value of $j$ for which both of these inequalities hold.


Let's get a baseline answer:

6 tests

Split the rods into groups of 2, test them (4).

If only one group is hot, you're good.
Otherwise, you have 2 groups of 2, 1 each which is radioactive. Test one of each. (2)
If hot, found; otherwise the other one is hot.

Edit: For a more generalized answer, I think the worst case is $2 * \log_2{N}$

Split the group in half, check both groups.
If one each, do binary search in each.
Otherwise, split the hot half, checking both groups.

  • 1
    $\begingroup$ I can't come up with a worst-case-scenario of 5 tests or fewer, so I imagine this is right...though the best-case-scenario is 1. $\endgroup$
    – Roland
    Commented Jul 31, 2015 at 17:06
  • $\begingroup$ I agree with Roland. There might be another approach that reduces expected number of measurements, but I think 6 may be the best in any worst-case scenario. $\endgroup$
    – Aggie Kidd
    Commented Jul 31, 2015 at 17:14
  • $\begingroup$ A best case scenario of 1 only works if you test by putting 6 rods into the box with no indication of radioactivity, it wouldn't work with groups of 2. $\endgroup$
    – Bard
    Commented Jul 31, 2015 at 18:04
  • $\begingroup$ @Bard What I meant is that unless Mike Earnest was asking a trick question (it could be interpreted as fewest possible), 6 is correct. $\endgroup$
    – Roland
    Commented Jul 31, 2015 at 18:52
  • $\begingroup$ Yeah I was confused on what he was asking specifically. I just wanted to clarify that you couldn't get a best case scenario of 1 test with this method. $\endgroup$
    – Bard
    Commented Aug 1, 2015 at 1:14

Here's another way to get

6 tests

First, split the rods into groups of 4 and test them (2)

If both groups have a radioactive rod, do the following for both groups: take two of the rods and test them. If the test is positive, check one of those two. If the test of two rods was negative, test one of the other two rods. If the check of the single rod is negative, it was the other rod in that pair. If it is positive, obviously you've found the radioactive rod. This takes 4 tests to check both groups.

If only one group has radioactive rods, split the group in two. If the first pair you check is not radioactive, it is the remaining two rods. Otherwise, test one of the two by itself - if it is not radioactive, you know the other one is and the second radioactive rod is in the other pair and can determine which with one more test. If the one you check is radioactive, test the other one. If it is not radioactive, the radioactive rod is in the other pair and can be found with one more test. The worst case scenario is 4 tests.


I guess I'll just add another answer for:

6 tests in a worst-case-scenario

But for a lowest average number of tests over many scenarios:

Label your rods A,B,C,D,E,F,G,H
To make use of all possible outcomes, test two equal groups, but leave two behind, so...

  1. Test A,B,C and D,E,F (2 tests)
    • if neither --> G and H are radioactive (2 total and done)
    • if only one group --> Go to Step 2. (Thanks, Aggie Kidd)
    • if both --> Go to Step 3.

P(done after step 1) = 1/28

  1. Test A,B,C (or D,E,F) and G,H one at a time
    • Keep testing (starting with G,H until two have been found or all but one is tested (4-6 tests)

P(done at step 2) = P(both in same trio) + P(trio and G,H) = 3/14 + 6/14 = 9/14

  1. Test A and D (2 tests) (this works testing A,B and D,E too)
    • if both --> A and D (4 total)
    • if A, but not D --> Test E --> then A and E or F (5 total)
    • if D, but not A --> Test B --> then D and B or C (5 total)
    • if neither --> Test B and E and deduce (6 total)

P(done at step 3) = P(one in each trio) = 9/28

I haven't worked through the probabilities/combinatorics completely, but this seems to have a lower average number of tests. If you had to stick with an algorithm from the beginning, this technically works better than some other algorithms, though the worst-case-scenario will still be 6 tests.

I'd be really interested to see someone prove that their answer is correct, which would involve calculating the probabilities of each test scenario to find the lowest average test number via Monte Carlo. If someone wants to do that, I'll owe them a lifetime's reputation.

  • $\begingroup$ Small problem on bullet two in step one. You need to account for G and H as well. $\endgroup$
    – Aggie Kidd
    Commented Jul 31, 2015 at 17:55

Since I don't see the non-adaptive answer posted yet... You can also derive the answer of "six tests" following the strategy described here in "Wolves and sheep":

A: Test rods 1, 4, and 5 together.  
B: Test rods 1, 6, and 7 together.  
C: Test rods 2, 4, and 6 together.  
D: Test rods 2, 5, and 7 together.  
E: Test rods 3, 5, and 6 together.  
F: Test rods 3, 4, and 7 together.  

Then look up the set of positive results in this table:

ABCD: 12    ACDF: 24    BDEF:  37    AB:  18
ABEF: 13    ACDE: 25    ACDEF: 45    CD:  28
ABCF: 14    BCDE: 26    ABCEF: 46    EF:  38
ABDE: 15    BCDF: 27    ABCDF: 47    ACF: 48
ABCE: 16    ACEF: 34    ABCDE: 56    ADE: 58
ABDF: 17    ADEF: 35    ABDEF: 57    BCE: 68
CDEF: 23    BCEF: 36    BCDEF: 67    BDF: 78

Julian Rosen's answer gives a proof (which I have not checked rigorously, but it sounds good) that it cannot be done in fewer than 6 tests, not even if you permit "adaptive" strategies.


Just because a test is successful doesn't mean we can eliminate the unchosen rods. Therefore, we always have to cover every group not yet confirmed to fail the test (if there aren't already 2 "successful" groups with no common rods), and their rods. The larger the groups that can be confirmed to fail are, the better. If the rods aren't divided equally, the smallest group might fail and the biggest ones succeed, so it doesn't give the best worst-case scenario.

After doing these, you'll know which quarter(s) has/have the radioactive rods. Even if they're two different quarters, you'll only need 2 more tests, which makes 6:

  • Take 4.
  • Take the other 4.

  • Take half of both groups.

  • Take the other halves.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.