What is the smallest set of weights that can measure every whole-pound load from 1 to 40 on a balance? Claude-Gaspard Bachet de Méziriac posed it in 1612. The answer is four weights, 1, 3, 9 and 27, and the reason is a number system where every digit is −1, 0 or +1.
The load sits on the left pan. Click a weight to move it: onto the right pan (against the load), onto the left pan (alongside the load), or back off the scale. A weight beside the load counts as negative, and that one trick is what makes four weights enough.
Try this: drag Load to any value, then press Show the answer.
Write a number in base 3 using the digits −1, 0 and +1 instead of 0, 1 and 2. That is balanced ternary, and each digit tells you exactly where one weight goes: +1 on the right pan, −1 on the left pan, 0 off the scale.
Each cell lists the weights 27 · 9 · 3 · 1 as + right pan, − left pan, 0 off.
Divide by 3 and keep the remainder as the next digit, like ordinary base 3. A remainder of 2 is the same as 3 − 1, so write −1 and add 1 to the quotient. In weights: instead of using the 1 twice, put the 3 on the right and the 1 next to the load.
The Setun computer, built at Moscow State University in 1958, did its arithmetic in balanced ternary. A nice feature: negating a number just flips every digit.
Pick any four weights and the page checks every load from 1 up to their total. Try to cover more than 40 with no gaps. The counting argument below shows why nobody can.
How to read this: each box is one load, from 1 lb up to the total of your weights.
How to read this: every load up to a bar's height can be weighed with no gaps; each grid line is 10 times the one below. The bright bar is the puzzle's four weights.
Each weight goes right, left or off, giving 81 arrangements. One of them is "all off", which weighs 0. The other 80 come in mirror pairs, since swapping every weight's side flips the sign. That leaves at most 40 different positive loads. The weights 1, 3, 9, 27 hit all 40 with no repeats, so they are perfect.
With one pan only, each weight is simply on or off: 2⁴ − 1 = 15 loads at most, reached by 1, 2, 4, 8. That's binary.
The weights are powers of 2 for one pan and powers of 3 for two. A fifth weight of 81 extends the two-pan range to 121.