Saturday, November 26, 2016

logical deduction - The counterfeit coin



You have 9 coins. One of the nine is counterfeit. The counterfeit coin can be distinguished by weight - it is heavier than the rest.


Using a balance scale only twice, find the counterfeit coin.



Answer



Ternary search.



Split into groups of 3. Call them first3group, second3group, third3group.


Now weigh first3group vs second3group. If first test shows equal weights, the heavy coin is in third3group. Split third3group and weigh 2. Where one is heavier, QED, otherwise, it is the non-weighed one, QED.



Else take the heavier group of 3 and do a similar exercise as described above when left with 3, 1 of which is heavier.



QED


No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...