# A King, 1000 Bottles of Wine, 10 Prisoners and a Drop of Poison

You have 1000 bottles of wine but one of them is poisoned! You want to find out exactly which bottle is poisoned.

You have 1000 bottles of wine but one of them is poisoned! You want to find out exactly which bottle is poisoned. To do this, you have access to an unlimited number of prisoners that you can feed wine to. If a prisoner drinks from the bottle that is poisoned, they will die after 24 hours. Prisoners are also allowed to drink from multiple bottles. Assuming that the amount of wine and prisoners is unlimited, what is the least number of prisoners needed to identify the exact bottle that is poisoned within 24 hours?
Think in terms of binary numbers. (now don’t read the solution, give a try).
Number the bottles 1 to 1000 and write the number in binary format.
bottle 1 = 0000000001 (10 digit binary)
bottle 2 = 0000000010
bottle 500 = 0111110100
bottle 1000 = 1111101000
Now take 10 prisoners and number them 1 to 10, now let prisoner 1 take a sip from every bottle that has a 1 in its least significant bit. Let prisoner 10 take a sip from every bottle with a 1 in its most significant bit. etc.
prisoner = 10 9 8 7 6 5 4 3 2 1
bottle 924 = 1 1 1 0 0 1 1 1 0 0
For instance, bottle no. 924 would be sipped by 10,9,8,5,4 and 3. That way if bottle no. 924 was the poisoned one, only those prisoners would die.
After four weeks, line the prisoners up in their bit order and read each living prisoner as a 0 bit and each dead prisoner as a 1 bit. The number that you get is the bottle of wine that was poisoned.
1000 is less than 1024 (2^10). If there were 1024 or more bottles of wine it would take more than 10 prisoners.