Problem #53 MEDIUM
The Spice Merchant's Weights
Scenario Number Theory Logic Deduction
Problem Statement
In the old spice market of Kochi, a merchant named Ibrahim has run his cardamom stall for forty years. He uses a traditional balance scale and a small set of brass weights to measure out purchases for his customers.
One afternoon, a young mathematics teacher named Kavitha stops at his stall and watches him work. She notices he has only four brass weights but seems to be able to measure any integer number of grams from 1 gram all the way to 40 grams.
'How is that possible with only four weights?' she asks.
Ibrahim smiles. 'I do not just put the weights on one side,' he says. 'I put them on both sides.'
Kavitha's eyes light up. She immediately understands. She asks: 'What are the four values of your weights?'
What are the four weight values that allow Ibrahim to measure every integer from 1 to 40 grams using a balance scale, where weights can be placed on either pan?
Answer & Quick Explanation
Think you've got it? Click below to check your answer.
The four weights are 1, 3, 9, and 27 grams. Placing weights on either pan of the balance scale creates a ternary system covering all integers from 1 to 40. Formula: k weights (powers of 3) cover 1 to (3^k - 1)/2.
Detailed Editorial Solution
Want to see the step-by-step breakdown? Click below to reveal the editorial.
When a weight can be on the left pan (positive), the right pan (negative), or not used (zero), it contributes three states. This is exactly base-3 representation. To cover 1 through N with k weights, use powers of 3: 1, 3, 9, 27, ... The total coverage is (3^k - 1)/2.
Step 1: With one side only (binary): weights 1, 2, 4, 8 cover 1-15. Each weight is double the previous.
Step 2: With both sides (ternary): each weight w can contribute +w (on opposite pan), -w (on same pan as item), or 0 (not used). This is a balanced ternary system.
Step 3: Weight 1: can measure 0 or 1. Weight 3: combined with 1, can measure 1+3=4, 3-1=2, 3 alone, 1 alone. Covers 1, 2, 3, 4.
Step 4: Weight 9: combined with {1,3}, can measure 9-3-1=5, 9-3=6, 9-3+1=7, 9-1=8, 9, 9+1=10, 9+3-1=11, 9+3=12, 9+3+1=13. Covers 1-13.
Step 5: Weight 27: combined with {1,3,9}, covers up to 27+9+3+1=40. Covers 1-40.
Step 6: The formula: k weights of values 1, 3, 9, ... 3^(k-1) cover all integers from 1 to (3^k - 1)/2. For k=4: (81-1)/2 = 40. Perfect.
Key Insight:
The ternary system doubles the efficiency of binary for physical weights. While binary (one-sided) weights grow as powers of 2, ternary (two-sided) weights grow as powers of 3 — a much faster expansion. The balance scale's two pans are the physical realisation of positive, negative, and zero in balanced ternary.