This is a solution to problem 24 on the hard interview questions node. If you have not read the question, the following will make no sense to you:

The trick here is that the superposition of two solutions is another solution, provided, of course, that they do not overlap. Here, we can superpose a solution for 3 tubes (4, 8, 12) and one for 2 tubes (3, 9).

Now we ask, for what numbers of test tubes is there a solution? There are solutions for 0, 2, 3, 4, 5, and 6 tubes. Note that the complement of a solution is also a solution, so therefore the only numbers for which there is no solution is 1 and 11.


QuietLight: I'm not sure what you mean by "sides." The requirement is that the centrifuge be radially balanced, that is, that the sum of the vectors from the center to each test tube is 0. The vectors for the tubes at 4, 8, and 12 sum to 0, as do the vectors for 3 and 9. 0 + 0 = 0.

Putting the 5th test tube in the center is clearly cheating ;-)