dineshboinapalli
A king has 1000 bottles of wine,A queen wants to kill the king and sends a servant to poison the wine .Fortunately the king's guard's catch d servant after he has only poisoned one bottle and the guard don't know which bottle is poisoned .Furthermore it takes one month to have an effect,and there is an anniversary party coming up in 5 weeks time!the king decides he will get some of the prisoners in his vast dungeons to drink the wine.how many minimum prisoners does it required to sample the wine to find out the poisoned bottle so that the guests will still be able to drink the rest of the wine at his anniversary party in 5 weeks time?
A. 1
B. 499
C. 500
D. 999
E. 10
Another way to imagine this distribution is in the form of binary numbers.
Let each bottle have a number B1, B2, B3, B4... till B1000.
In binary form, you can represent
1 as 1,
2 as 10,
3 as 11,
4 as 100 as so on...
till 1000 as 1111101000
You don't actually need to know how to write 1000 in binary but you do need to know the number of digits required to write 1000 in binary form.
How many digits do you need to represent numbers till 1000? You will need 10 digits because 2^9 = 512 is written as 1 with 9 zeroes (total 10 digits) and 2^10 is written as 1 with 10 zeroes (total 11 digits).
In binary code, 1000 is 1111101000.
Since you need 10 digits to represent 1000 numbers in binary, you will need 10 prisoners.
Now the logic is this: Every bottle has a unique number from 1 to 1000 and a unique binary representation from 0000000001 to 1111101000.
Now you have 10 prisoners. Each bottle will be tasted by the prisoners depending on the binary representation of the bottle. Wherever there is 1, the bottle will be tasted by that prisoner (assuming units digit represents the 1st prisoner, tens digit the 2nd prisoner and so on...)
1st bottle is 0000000001 so it will be tasted by only the 1st prisoner.
2nd bottle is 0000000010 so it will be tasted by only the 2nd prisoner.
3rd bottle is 0000000011 so it will be tasted by the 1st and 2nd prisoners.
and so on...
1000th bottle is 1111101000 so it will be tasted by 4th, 6th, 7th, 8th, 9th and 10th prisoners.
At the end of a month, we see which prisoners die. Say, only the 3rd prisoner dies. This means the poisoned bottle number is 0000000100 = 3.
Say 1st, 7th and 9th prisoners die. This means the poisoned bottle number is 0101000001 = 321