 # number theory — every integers from 1 to 121 can be written as 5 powers of 3

## How many minimum weights do you need to measure all weights from \$1\$kg to \$1000\$kg

You need a 1kg, 3kg, 9kg, and a 27kg weight.

You can achieve different weights by changing the sides of the weights.

For instance, a 3kg weight on the right and a 1kg weight on the left would let you weigh 2kg on the left.

Here is a problem I was sent, which it turns out was first posed by Claude Gaspard Bachet de Méziriac in a book of arithmetic problems. The problem is as follows:

A few years ago, a King’s mathematics professor purchased a small farm, a place where he could unwind on the weekends and grow some fruit and vegetables. The farm came with all kinds of tools and various implements, including a large balance scale. Next to the scale was an old (pre-metric) 40 lbs stone with some initials carved into it: apparently, a previous owner had used it to weight 40 lbs of feed.

One morning, while cleaning out his barn, the professor dropped the stone and it broke into four pieces.

The professor was a bit sad about his carelessness, as he had liked that curious old stone. But he soon discovered something interesting: He could use the four pieces of the broken stone to weigh items on the balance scale — as long as these items were in one pound increments, between 1 and 40 pounds.

How much did each of the four pieces weigh?

Note that since this was a 17th-century merchant, he of course used the balance scale to weigh things. So, for example, he could use a 1 lb weight and a 4 lb weight to weigh a 3 lb object, by placing the 3 lb object and 1 lb weight on one side of the scale, and the 4 lb weight on the other side.

I won’t post the solution as maybe some of you would like to give this a go. For anyone reading this and wanting to try it themselves, DON’T SCROLL DOWN! People will be posting their solutions there.

I did this using an intuitive method but my question I am asking is in two parts:

1) Is there an algebraic solution to this without first solving it intuitively and then finding the logic

2) Is there therefore a general form you can take to solve any problem of this type?

Good luck!

It turns out that you need four weights, measuring 1, 3, 9, and 27 pounds.

The trick here is that you can put weights on both sides of the scale. If you have an object of 2 pounds on the left side, you can place the 3-lb. weight on the right side and the 1-lb. weight on the left side for the scale to balance.

Similarly, if the object weighs 5 pounds, you put the 9-lb. weight on the right side and the 3-lb. and 1-lb. on the left side.

If you have a set of weights that can balance any weight from \$1\$ to \$N\$ pounds, then they can also balance any weight from \$-1\$ to \$-N\$ pounds just by switching the sides of the scale that you place them on. So the next weight you’d want to add would weigh \$2N 1\$ pounds, and then you can balance any weight from \$1\$ to \$3N 1\$ pounds on the scale.

So, starting with the 1-lb. weight, which can balance any weight from \$1\$ to \$1\$ pounds, we get \$2(1) 1 = 3\$ pounds for the next weight, and they can balance anything up to \$1 3 = 4\$ pounds.

Then, for those two weights, we get \$2(4) 1 = 9\$, and they can balance up to \$1 3 9 = 13\$ pounds.

And finally, for all three of those weights, we get \$2(13) 1 = 27\$, and they can balance up to \$1 3 9 27 = 40\$ pounds, as required.

In general, to measure any weight up to \$n\$ pounds, you will need at least \$lceillog_3(2n)rceil\$ weights due to the above formula.

The answer is \$7\$. Notice every «state» of the balance can be described by a list which says the position of each balance, the position can be «left, right» or «not on the weight». If we had less than \$7\$ weights there would be at most \$3^6\$ possible states, this is less than \$1000\$.

On the other hand taking the weights \$1,3,9,27,81,243,729\$ allows us the measure every integer weight between \$0\$ and \$1093\$

Proof of this is straightforward with induction, try proving with weights \$1,3,9dots 3^{n}\$ you can weight everything between \$0\$ and \$dfrac{3^{n 1}-1}{2}\$

Use powers of \$3\$: \$1,3,9,27,81\$ can weigh anything up to \$121\$.

The trick is to place weights on both sides of the pan. Without that, the maximum you can do is with powers of two, and five of those will allow you to go up to \$63\$. At least if you only consider exact weighings. If you’re allowed to infer that the weight is \$14\$ if it is heavier than \$13\$ and lighter than \$15\$ will probably allow you to go a bit higher, and I don’t yet see a systematic way of going about this.

\$121\$ is the maximum you can do with 5 weights. See http://www.uri.edu/artsci/math/clark/mthdl/scale/explore.pdf for necessary and sufficient conditions.

On the other hand, since you can optimally go up to \$121\$, there is some choice if you only want to go up to \$100\$. There are 132 sets of weights that work, 15 of them measuring up to exactly \$100\$, and the lexicographically smallest one is \$1,3,7,22,67\$.

Further, the proof for sufficiency is constructive. That is, you can figure out an algorithm to tell you which weights go on which side for any of these sets of weights.

## every integers from 1 to 121 can be written as 5 powers of 3

The style of numbers, based on the balanced base 3, gives these exactly.

The proof that the powers of three are the only set, can be proven by the following. Suppose the weights are abcde, which can be either 1 (opposite the load), 0 off the scale, or M with the load.

The set E represents all weights reachable by the weights a-e. This is required to be compact, but for every combination for x, simply reversing the 1 and M gives -x. So the compact range goes from -121 to 121, ie all posibilities. We see that any weight by itself must be integer, ie 01000.

Swapping a weight from 1 to M, makes an even change, so an odd change requires the removal of a weight. When 11111 represents 121, and removal of the lightest gives 120, then we see that e=1 is the only solution.

We now represent D as a combination of a,b,c,d, and note that the 81 combinations of D become 243 of the form D e, D, D-e, D’ e, D’, D’-e, where D and D’ are adjacent combinations of a,b,c,d. Because this implies that all D must be multiples of three.

Dividing D into some minimum d and a set C. The arguement is as above: the value of d is 120 — 117 (the largest two members), and all of C is 9. Repeat to show that c=9, b=27 and a=81.

Failing this, one can add the number 121 (11111 in base 3), that gives a different number, where the weight is left off the pan (1), in with the object to weigh (0), or on the side with the major weight (2).

Suppose the weight to weigh is a stone (14 lb), the number in base 3, is 112. Adding 11111 to this, gives 12000. This means we leave out the 81 weight (1), put the 27-weight opposite the stone, and put the 9, 3, and 1 weights with the stone. The balanced form of 14 is 1MMM, where M is the digit for -1.

The same number system can be used to find a faulty coin (in excess or deficit), from 120 coins, with just 5 weighings. Number the coins from 1 to 121, excluding 61, according to the balanced rule, or from 122 to 242, excluding 182, according to the usual base-3 style numbers. The odd coins are then reversed (ie if there are an odd number of M,1, then the 1’s and M’s are swapped.

The five weighings, then proceed by the digits of the number. For the \$n\$ weighing, put coins with an M in the \$n\$ column, in the left, and those marked \$1\$ in the right. If the M pan descends, write \$M\$, if the \$1\$ pan descends, write \$1\$. Otherwise write \$0\$. Proceed in a similar manner through all five columns, until you have a five-place number.

If there is an odd number of \$M\$ and \$1\$ (together), one needs to reverse these (to \$1\$ and \$M\$). The number at the end of this, will tell you if the coin is in defect (the first non-zero number is an M), or excess (1), Swapping M with 1 in all the places will reveal the number of the defect coin, the number as stands is the excess.

So a weight giving results 0,M,1,1,1 tells us that it is an even coin, so no reversal is needed. It tells us that the coin is in defect (ie the first weight is M), and that finally it’s the coin we’re calling 14 (1MMM = 14).

If 1MMM is too much, one can write it as 1-centric form (12000), and subtract 121 from that (135 — 121 = 14).

## Every year, there is a contest…

Observations

Let the five terms be represented by \$a{amp}lt;b{amp}lt;c{amp}lt;d{amp}lt;e\$.

Let’s suppose there are solutions to the problem.

On the lower end, we know that \$a b=108\$.

We also can deduce that \$a c=112\$

On the upper end, we know that \$d e=122\$

We can also deduce that \$c e=120\$

Substituting, we discover that \$c=b 4\$ and \$c=d-2\$.

Now we know the difference between our central 3 values. The center should be ~\$b 3\$

\$\$b=b\$\$
\$\$c=b 4\$\$
\$\$d=b 6\$\$

The range is \$6\$. As you already pointed out, the mean is \$57.75\$, which we’ll say is \$58\$ to make calculations easier.

Using this, let’s guess that \$b\$ is \$3\$ below \$58\$. When this is the case, our values are the following:

\$\$a=53\$\$

\$\$b=55\$\$

\$\$c=59\$\$

\$\$d=61\$\$

\$\$e=61\$\$

To achieve \$b,c,\$ and \$d\$, simply plug in \$57\$ for \$b\$ in the above calculations and you’ll obtain \$a\$ and \$e\$ by subtracting \$b\$ from \$108\$ and \$d\$ from \$122\$, respectively. Obviously these cannot be the correct weights since \$d=e\$, but let’s add each combination to see how close we are. Upon doing so, we get the following values:

\$\$a b=108\$\$

\$\$a c=112\$\$

\$\$a d=114\$\$

\$\$b c=114\$\$

\$\$a e=114\$\$

\$\$b d=116\$\$

\$\$b e=116\$\$

\$\$c d=120\$\$

\$\$c e=120\$\$

\$\$d e=122\$\$

Now we’ll try guessing that \$b\$ is \$3.5\$ less than \$58\$

In this case, we get the following:

\$\$a=53.5\$\$
\$\$b=54.5\$\$
\$\$c=58.5\$\$
\$\$d=60.5\$\$
\$\$e=61.5\$\$

These values yield the following:

\$\$a b=108\$\$
\$\$a c=112\$\$
\$\$b c=113\$\$
\$\$a d=114\$\$
\$\$a e=115\$\$
\$\$b d=115\$\$
\$\$b e=116\$\$
\$\$c d=116\$\$
\$\$c e=120\$\$
\$\$d e=122\$\$

This set was extremely close, but we had duplicate \$115\$ and \$116\$ values and lacked our \$117\$ and \$118\$ values.

I know others have already shown that there is no solution, but I thought this might help show that although it cannot be done, there are pumpkin weights that yield almost all of your values.

## Only 4 Weights Puzzle You have a balance scale with four weights. With these four weights you must balance any whole number load from 1kg all the way up to 40kg.

How much should each of the four weights weigh?

(You may place weights on both sides of the scale at the same time.)

Понравилась статья? Поделиться с друзьями: 