Given a balance scale, and a set of 4 weights, weighing 1, 3, 9, and 27 grams respectively, one can accurately measure the weight of any unknown object of weight 1, 2, 3, ... 38, 39, or 40 grams. For example, to identify an object X as being 5 grams in weight, one could simply place:
If and only if the scale balances, X weighs 5 grams. More importantly, for any X with weight 1 to 40, there exists exactly one unique configuration of weights that measures X (if we force X to be on the left).
Suppose we always put X on the left. What, then, is the sum of the weights on the right, across all 40 unique configurations?
An explicit example: If we only count unknown weights 1 to 4, we get the following 4 configurations:
The sum of the weights on the right across all 4 configurations is 11 :
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
There are multiple ways to get to the answer here, some involving clever pattern observations. The simplest, brute-force approach is to enumerate all possible arrangements of weights, and simply sum the weights on the right hand side if and only if it is larger than the left.
Here's some python: