Minimum number of objects required to figure out the issue

2.1k Views Asked by At

There 1,000 buckets, one of them contains poison, the rest of them are filled with water. They all look the same. If a pig drinks that poison, it will die within 30 minutes. What is the minimum number of pigs to you need to figure out which bucket contains the poison within one hour?

3

There are 3 best solutions below

2
On

Assuming pigs can't share buckets:

If a pig drinks a blucket it must wait 30 minutes to drink another one. Otherwise we don't know which one killed him. That means each pig can only give information about 2 buckets. So with 499 we can only get information from 998 buckets. If none of them are poisonous either one of the remaining could have the poison. However with 500 pigs we can get info on all of them.

0
On

1 pig drinks from 500 buckets, then we wait 30 minutes; if it dies you need other 499 pigs, to check 499 buckets among the first ones; if it doesn't die we need other 498 pigs which together with the first pig can check the other 499+1 buckets. So we need at most 500 pigs.

7
On

You can do it with $10$ pigs, based on the binary representation of a number. Mark the pigs $1, 2, ..., 10$. Given bucket number $n$, write $n$ in binary; every time the $k$th digit is $1$, have pig #$k$ drink.

Wait for pigs to die. Form the appropriate number, putting $0$'s for every living pig in the appropriate place, and $1$'s otherwise. The number formed marks the bad bucket.

Note that I'm assuming that the pigs can drink from a lot of buckets quickly, and that more than one pig can drink from a bucket.