In detail

Problem in the toy store

Problem in the toy store

10 bags of marbles have arrived at the toy store, each of which contains 1000 marbles. The problem is that the unlabeled bags have arrived and we cannot distinguish those bags that contain 9 grams marbles from those that contain 10 grams marbles which is a problem since they are sold at different prices.

We have a scale in the store and we know that each bag contains single-weight marbles, either 9 grams or 10 grams.

How many heavy we would have to do at least to be able to identify which bags containing 9 grams marbles and which ones contain 10 grams marbles?

Solution

With a heavy one it would be enough. We put the bags in order and take a quantity of marbles from each that corresponds to a power of 2. Thus, we would take 1 marble from the first bag, 2 from the second, four from the third, 8 from the fourth and so on 512 marbles of the tenth bag.

To weigh them, if all the marbles weigh 10 grams, the scale would mark 10230 grams but since we will have some 9 grams marbles the weight will be 10230 - X. Once we find out X from the weight that marks the scale, we know that it can be rewritten uniquely as a sum of the powers of two and each exponent of the power will indicate the bag containing 9 gram marbles.

For example, if the weight obtained were for example 9924 we would have X = 10230 - 9924 = 306 = 22 + 25 + 26 + 29 So we know that bags 2, 5, 6 and 9 contain marbles of 9 grams.