# The bottle(s) of pills of a different weight

I am a laboratory man dealing with random medicine.

### Day 1

I have 10 bottles of pills. 9 of them contain good pills that weigh 1.000g each, and the other one contains bad pills that weigh 0.999g each. There are uncountably many pills in each bottle.

I have a digital scale that is as precise as exactly 1mg, and can measure at a rather high value (even more than several kilograms) while maintaining the precision. How many times do I have to operate the scale to identify the bottle with bad pills?

### Day 2

The factory has gone crazy. They send me another 10 bottles of pill, some of them (maybe zero, maybe all) contains bad pills. Weight specifications remain the same as above. I need to find out all bottles of bad pills with the same tool above, operating it for as fewer times as possible.

### Day 3

Finally I'm crazy. I have once more 10 bottles of pills. There are two kinds of bad pills today - one of them weighs 1.001g each and the other weighs 0.999g each. How can I identify all bottles into "good", "overweighed" and "underweighed", with minimal use of my only scale (yet precise and powerful)?

## Day 1:

One weighing, $$\sum_{n=0}^{9}n = 45$$ pills.

Method:

Label the bottles with numbers from $$0$$ to $$9$$. Combine $$N$$ pills from each bottle, where $$N$$ is the label on the bottle. The number of missing milligrams is the label on the bad bottle.

## Day 2:

1 weighing, $$\sum_{n=0}^{9}2^n = 2^{10} - 1 = 1023$$ pills

Method:

Same method as before, but this time, combine $$2^N$$ pills from each bottle. Write the number of missing milligrams in binary. Starting from the right, the binary number has a 1 at each bad bottle's place.

## Day 3:

1 weighing, $$\sum_{n=0}^{9}3^n = \frac{3^{10}-1}{2} = 29524$$ pills

Method:

Same as before, but combine $$3^N$$ pills from each bottle. Calculate the result if all pills were light. (It's 29494476 mg, or just under 30 kg, by the way). Subtract this number from the actual measured weight, and write the result in ternary. Starting from the right, the ternary number has a 0 for an underweight bottle, a 1 for correct weight, and a 2 for an overweight bottle.

For example, if bottle 0 is overweight, bottles 1 and 2 are correct, and the rest are underweight, then

the difference will be 14mg, which is 112 in ternary.

We can do this in

1 weighing

by

taking 1 pill from one bottle, 2 from another, 3 from the 3rd... and 10 from the 10th. For every mg we're short from (1+2+3+4+5+6+7+8+9+10) = 55g, the bottle we took that many pills from is the one with the lighter, and thus, bad, pills.

# Day 2

We can do this in

1 weighing

by

taking 1 pill from bottle 1, 2 pills from bottle 2, 4 pills from bottle 3... and 512 pills from bottle 10. The amount of mg we're short from 1023 can be broken down into only one configuration of these, revealing all the bottles that have bad pills.

• After re-reading the question, yeah, this is better. When I read it, I thought the bottles each weighed that much, not the pills. Dec 7, 2018 at 17:17