### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,609)
- enigma-book-1982 (70)
- misc (5)
- project euler (2)
- puzzle (90)
- puzzle# (173)
- site news (76)
- tantalizer (189)
- teaser (7)
- today (1)

### Site Stats

- 310,314 hits

Programming Enigma Puzzles

13 June 2022

Posted by on **From New Scientist #2015, 3rd February 1996** [link]

I used to run a village shop and I had a pair of scales and a set of 10 weights. Each weight was a whole number of ounces and the total weight was less than 1024 ounces. I found that I could [

not] put one or more weights on each of the two pans of my scales so that they balanced.One day I lost a weight. By chance I was able to replace it with a spare; unfortunately it was not the same weight as the one I lost. However, now I could put one or more weights on each of the two pans of my scales so that they balanced; in fact, I could arrange for each side to weigh 6 ounces. Unfortunately I could not weigh 13 ounces, although I could weigh 3 ounces.

Q1.What was my set of weights after the replacement?

Q2.Suppose I was back with my original set of weights. Could I have selected one and replaced it by some other whole-number-of-ounces weight, of my own choosing, so that the total weight was still less than 1024 ounces and I still could not put one or more weights on each of the two pans of my scales so that they balanced?

Q3.AsQ2but now I can replace six weights instead of just one. The new set of weights must not be the same as my original set.

This statement takes into account the correction to the puzzle published with **Enigma 866**.

I also added the “**not**” in square brackets into the text, as without it the puzzle doesn’t make sense to me.

[enigma860]

%d bloggers like this:

If there are 10 weights, then by combining them we can make (2^10 − 1) = 1023 non-empty collections of weights.

And each of those collections must have a different value (total weight), in the range 1 – 1023 (otherwise we would be able to find two sets of weights that balanced).

The only way to achieve this is to use weights that are powers of 2.

So the initial set of weights is: (1, 2, 4, 8, 16, 32, 64, 128, 256, 512).

And this answers the second and third questions:

Solution:Q2,Q3:No.And so we turn to

Q1:With the replacement we can’t make 13, so one of the lost weights must be (1, 4, 8) (as these are the unique set of weights used to make 13), and there is more than one way to make 6, so the replacement weight cannot weigh more than 6.

This Python program runs in 60ms. (Internal run time is 376µs).

Run:[ @replit ]Q1:After replacement the set of weights had values: 1, 2, 4, 5, 16, 32, 64, 128, 256, 512.After the replacement we can’t make 13, 14, 15. But 6 can be made from 1+5 or 2+4 (and we could also balance 5 = 1+4).