In this Stock Puzzle, you are given a number of coins, or bags of coins, and a balance. You are told that one coin or bag is heavier or lighter than the others (in most versions of the puzzle, the odd-weight coins are counterfeit). Through a limited number of weighings, you must determine which coin or bag of coins is counterfeit.
The usual version is 12 coins (or bags, or whatever) with three weighings, which has several solutions, some more intuitive than others. It's easier if you know whether the counterfeits are heavier or lighter than the genuine coins, so in trickier versions of the puzzle you must figure this out as well. A third variation may give you 13 coins (but you know whether the counterfeits are heavier or lighter) - some of the 12-coins-unknown-weight solutions also work for this (simply leave the extra coin out, and then if it was the counterfeit, you'll figure that out in the three weighings). 13-coins-and-unknown-weight is not possible in the standard three weighings.
If you know whether the bad coins are heavier or lighter, the solution is to divide the coins into three groups of four coins each. Weigh group A against Group B. If they are balanced, the bad coin is in group C. If they do not balance, the bad coin is on the side corresponding to the description of the bad coin. (If it is heavier, the heavier side contains the bad coin; if the bad coin is lighter, the lighter side contains it.) Now take the coins in the group known to contain the bad coin and weigh two against two. Again one side will be off in the same direction in which the coin is bad: The counterfeit coin is one of those two. Weigh those two coins against each other.
If the more complicated version is used, and whether the bad coin is heavier or lighter is not known, the procedure is a little different and more complicated.
- Put four coins on each side. There are two possibilities:
- 1. One side is heavier than the other. If this is the case, remove three coins from the heavier side, move three coins from the lighter side to the heavier side, and place three coins that were not weighed the first time on the lighter side. (Remember which coins are which.) There are three possibilities:
- 1.a) The same side that was heavier the first time is still heavier. This means that either the coin that stayed there is heavier or that the coin that stayed on the lighter side is lighter. Balancing one of these against one of the other ten coins will reveal which of these is true, thus solving the puzzle.
- 1.b) The side that was heavier the first time is lighter the second time. This means that one of the three coins that went from the lighter side to the heavier side is lighter. For the third attempt, weigh two of these coins against each other. If one is lighter, it is the unique coin; if they balance, the third coin is the light one.
- 1.c) Both sides are even. This means that one of the three coins that was removed from the heavier side is heavier. For the third attempt, weigh two of these coins against each other: if one is heavier, it is the unique coin; if they balance, the third coin is the heavy one.
- 2. Both sides are even. If this is the case, all eight coins are identical and can be set aside. Take the four remaining coins and place three on one side of the balance. Place 3 of the 8 identical coins on the other side. There are three possibilities:
- 2.a) The three remaining coins are lighter. In this case you now know that one of those three coins is the odd one out and that it is lighter. Take two of those three coins and weigh them against each other. If the balance tips then the lighter coin is the odd one out. If the two coins balance then the third coin not on the balance is the odd one out and it is lighter.
- 2.b) The three remaining coins are heavier. In this case you now know that one of those three coins is the odd one out and that it is heavier. Take two of those three coins and weigh them against each other. If the balance tips then the heavier coin is the odd one out. If the two coins balance then the third coin not on the balance is the odd one out and it is heavier.
- 2.c) The three remaining coins balance. In this case you know that the unweighed coin is the odd one out. Weigh the remaining coin against one of the other 11 coins and this will tell you whether it is heavier or lighter.
- 1. One side is heavier than the other. If this is the case, remove three coins from the heavier side, move three coins from the lighter side to the heavier side, and place three coins that were not weighed the first time on the lighter side. (Remember which coins are which.) There are three possibilities:
There are other solutions, some of them with spiffy mnemonics, e.g. here and here.
Interestingly, if you know whether the odd coin is heavier or lighter, you can handle up to 27 coins in three weighings (weigh 9 against 9, then 3 against 3, then 1 against 1).^{note }
Another similar puzzle has you given a number of bags of coins and a mass measurement scale that you can use once, and being told that one bag's coins all weigh X and the rest all weigh Y. The solution for this one involves taking one coin from bag A, two coins from bag B, etc., and figuring out how much the resulting measurement differs from what you would get if all the coins weighed the same.
Examples
- The Kindaichi Case Files uses the ten-bags-of-coins variant. Kindaichi solves it almost immediately, necessitating him to explain the solution to a bewildered Miyako. The person who had posed the problem turns out to be the murder suspect, and she bemoans that she should have realized Kindaichi would see through her tricks given how casually he blew through the question.
- One Perplex City card has a variant, where you must figure out how to identify pills of a different weight from five jars in one weighing.
- Used in With a Tangled Skein by Piers Anthony. The heroine had to use this puzzle to find a certain soul disguised as a demon, out of the 12 demons. It doesn't work due to Satan, but things resolve regardless.
- She also only knows that it is one disguised soul amongst demons, so initially does not realize how weight plays a factor. After some internal panic, she remembers that sin weighs souls, so a good soul will be lighter to drift to heaven.
- Brooklyn Nine-Nine: Captain Holt asks the detectives a version of this in the "Captain Peralta" episode with twelve men on an island instead of coins and offers tickets to a Beyoncé concert for anyone who can solve it. Turns out that his own mentor asked him the same riddle and he couldn't figure it out so he set the whole thing up so the detectives would figure out the answer and he could impress his mentor by pretending he figured it out.
- It appears using a spell that detects the power level of cubes in the Infocom game Spellbreaker; naturally, the spell can be used only three times. And you don't know whether the correct cube will glow more or less than the fakes.
- Or only two times, if you take any of the treasure, making the puzzle and the game Unwinnable. The random number generator will be biased against you if you screw up.
- After three weighings the game determines which coins might be the fake given the information you have, and if there's more than one possibility the game will switch it so that you have the wrong coin. Infocom was great.
- Mentioned in Fire Emblem: The Sacred Stones, where Ewan presents this puzzle to Ross in a support conversation. However, in a slight twist, he doesn't ask how to do it in three weighings: he gives the more generic challenge of asking what is the minimum number of weighings required (and makes it 25 pebbles, not 12 coins). Ross immediately answers 24 (i.e., weighing the pebbles one by one), then after some encouragement from Ewan, answers 4. Close, but no cigar - the answer is still 3.
- Appears in a few different variants, usually involving weights rather than coins, in the Professor Layton series of games.
- There is a similar puzzle in Drakensang 2 The River Of Time. In order to open a chest, you're given several iron and lead weights and you must put the right number of them in the four boxes around the altar. If you can't find the solution, you can ask the druid Megalesios to solve it for you, but you won't gain any experience.
- Appears in the Jules Verne-inspired adventure game Voyage, where you have to isolate the lightest of twelve 'isotopes' in the fewest number of steps, with varying points available depending on which of the above solutions you use.
- Subverted in Virtue's Last Reward, where there are four coins to weigh and a scale that gives you five weighings before resetting itself. As the weights of the coins are constant, and there are only four of them, the resetting is just a nuisance.
- One of the puzzles in Safecracker (1996) involves a key-weighing machine that can only be used in two moves, in which the objective is to find one out of eight keys that's heavier than the others. Choosing the wrong key or making more than two moves scrambles the keys and resets the puzzle.