## Balance-scale problem

Using a balance-scale, how many weights are needed
. . to weigh integral weights from 1 to 40 pounds?

The answer is four: 1-, 3-, 9-, and 27-pound weights.

These are obviously powers-of-3 which are inherent in a balance-scale problem.
The scale has three possible states: left side down, right side down, and balanced.

Suppose we wish to weigh 34 pounds of, say, sand.
What weights should be used and how will they be placed?
. . The answer is: .$\displaystyle [3,\,\text{sand}] \;_{\land}\;[1,\,9,\,27]$

Is there a procedure for determining the weights and their placement? . . . Yes!

Convert the number to base-3: .$\displaystyle 34 \,=\,1021_3$

Since $\displaystyle 1021_3$ means: one 27, no 9, two 3's, and one 1,
. . we have: .$\displaystyle [\text{sand}] \;_{\land} \;[27,\,3,\,3,\,1]$

We have a problem: we do not have two 3-pound weights.

So we do something silly: add another 3-pound weight to each side.
. . We have: .$\displaystyle [3,\,\text{sand}] \;_{\land}\;[27,\,3,\,3,\,3,\,1]$

Of course, we don't have three 3-pound weights either,
but they can be replaced by one 9-pound weight.
. . So we have: .$\displaystyle [3,\,\text{sand}] \;_{\land}\:[27,\,9,\,1]$ . . . There!

Must we go through this juggling every time? . . . No.

We have the number in base-3: .$\displaystyle 1021_3$

Start at the right:
. . if the digit is 0 or 1, copy it down.
. . if the digit is 2, replace it with -1, add 1 to the next position.

We have:
. . $\displaystyle 1\quad0\quad2\,\underbrace{1}_\downarrow$
. . $\displaystyle 1\quad0\,\underbrace{2}_\downarrow\, 1$
. . $\displaystyle 1\;\;\,\overbrace{1\;\;\;\text{-}1}\;\;\,1$

The resulting "number" .$\displaystyle \{1,\,1,\,-1,\,1\}$ gives us the placement of the weights.
. . It says: One 27, one 9, negative-one 3, and one 1.
The negative-one indicates that the 3-pound weight goes on the other side.
. . Once again, we have: .$\displaystyle [3,\,\text{sand}] \;_{\land}\;[27,9,1]$

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Try it yourself with five weights: 81, 27, 9, 3, 1 ... and a limit of 121 pounds.

For example: 86 pounds.

Convert to base-3: .$\displaystyle 86 \,=\,10012_3$

This ternary number will convert to: .$\displaystyle \{1,\,0,\,1,\,\text{-}1,\,\text{-}1\}$

Hence: place the 81- and 9-pound weights in one pan,
. . . . . and the 3- and 1-pound weights in the other pan with the sand.