The Weight That Broke in Four
The puzzle
A shopkeeper's 40 kg weight falls and breaks into four pieces. To his surprise, he finds he can still weigh out any whole number of kilograms from 1 to 40 on his two-pan balance.
What do the four pieces weigh? Remember that a weight may be placed in either pan.
Stuck?
One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.
Hint 1
Putting a weight in the same pan as the goods subtracts it instead of adding it.
Hint 2
So each piece can count as +1, 0 or -1 times itself. Three options per piece.
Show the answer Hide the answer
1, 3, 9 and 27 kg - the powers of three, which indeed add to 40.
How to get there
Because a piece can go in the goods pan, with the goods, or in the other pan, or be left out, every piece contributes -w, 0 or +w. Four pieces therefore give 3^4 = 81 combinations, covering values from -40 through 0 to +40: exactly the 40 positive targets, once each.
That is balanced ternary, and it works only if the pieces are 1, 3, 9, 27. To weigh 5 kg: put 9 in the empty pan and 3 + 1 in the pan with the goods, because 9 - 3 - 1 = 5. To weigh 20 kg: put 27 + 3 in the empty pan and 9 + 1 with the goods, because 30 - 10 = 20.
And 1 + 3 + 9 + 27 = 40, which is why the broken weight accounts for itself. Had the pieces been 1, 2, 4, 8 - the powers of two - they would only have weighed up to 15, because that scheme never uses the second pan.
The technique worth keeping
Count the states each resource can occupy before choosing its size. A two-pan balance gives three states per weight, so powers of three are optimal; a one-pan scale gives two, and powers of two win there instead.