So there's this king. Someone breaks into his wine cellar where he stores 1000 bottles of wine. This person proceeds to poison one of the 1000 bottles, but gets away too quickly for the king's guard to see which one he poisoned or to catch him.

The king needs the remaining 999 safe bottles for his party in 4 weeks. The king has 10 servants who he considers disposable. The poison takes about 3 weeks to take effect, and any amount of it will kill whoever drinks it. How can he figure out which bottle was poisoned in time for the party?

See Solution

There are a few keys to this puzzle: 1) The king has to mix wine in order to isolate the single poisoned one. 2) There are 10 servants. After about 3 weeks, each one can be either dead or alive, meaning that there are 2^10 = 1024 possible outcomes. Since 1024 > 1000, it's actually possible for some scheme to work. 3) This puzzle is much easier if you have any knowledge of binary numbers

Here's the scheme: The king assigns each servant a number from 1-10. The king assigns each bottle a number from 0-999. When he labels them, though, he writes the number on the bottle in binary with ten digits, like this: 0: 000000000 1: 000000001 2: 000000010 3: 000000011 4: 000000100 5: 000000101 ... 999: 1111100111 and so on. Read this if you don't know binary: http://en.wikipedia.org/wiki/Binary_number.

Now, each servant takes a small sip from every bottle where the servant's number equals 1 in the binary number on the bottle. So, the 1st servant drinks from every other bottle. The second servant drinks from bottles 2, 3, 6, 7, 10, 11, etc.

Then based on the combination of servants that die, he can identify the poisoned bottle. For example, if none of them die, the 0th bottle was poisoned because none of them drank from it. If only servant 1 dies, then bottle 1 was poisoned, because he's the only person who drank from it. Finally, if servants 1, 2, 3, 6, 7, 8, 9, and 10 die, then the 999th bottle was poisoned (see how this matches up with 999 above).

## Comments

Sign uporlog in with Facebookto comment.Trisha ShahAbcdAnurag PoddarHundreds, tens, ones. (reminds me of Kindergarten)

Anurag PoddarBTW, you do not need binary or complicated stuff as given in the official answer.

RaviCan you elaborate on your solution?

Abhishek Harshvardhan MishraIf the time until death is fixed and that is 3 weeks, you needn't kill more than 1 servant. Make the person drink the wine from each bottle and divide 1 week in 1000 parts and in each part let him drink from one bottle. Now, after 3 weeks observe the clock and the corresponding time of death would indicate the bottle which is poisoned.

Trisha Shah[MindCipher!]

blingoAwesome riddle!

Some remakes regarding the solution: Key (1) isn't a part of the suggested scheme, and also "every bottle" on line 10 isn't true.

RaviYou're right. Perhaps the original intention was to say "each of the servants can/must try multiple wines"?

Michael MantoGreat puzzle! Ignore the jerks.

Guys, puzzles are about the logic of problem, the story is just a delivery. If you are pathetic enough to dissect the entire story then it's probably because you are insecure at being too stupid to be able to reason out a solution.

Jay Elliott+1 Michael. This same problem without a supporting story would just be ridiculous.

kushalgjxdfjsr

Kunal SuriBeautiful. Reminds me of code correction in computers.

Sahil SethiSolved it in 5 minutes. Nice question though

RaviI was asked this question in a job interview last year. It's a great question that really challenges one's ability to dissect a problem and carefully use the given information. (I'm being intentionally vague so I don't ruin it for others)

WillWine tends to only last about a week at most after opening, so the solution seems flawed as the king now has 999 bottles of spoiled wine and a bunch of dead servants.

Furthermore if nobody saw the thief poison a bottle it would be improbable to know that if a bottle was poisoned at all.

That's not to mention the method of injection, which for the sake of argument we will assume hypodermic needles have already been invented. With the amount of pressure it takes to insert a cork into a wine bottle I think it's safe to assume that the needle would have to be big enough to be durable so that it could even puncture the cork.

I would look for floating bits of cork inside the bottle, or assuming the wine had been collected over a period of time, examine the dust around the wine rack.

Aakash SahneyThis comment reminds me of this Richard Feynman interview

RaviThat's hilarious!

And why is the solution you were clearly driving me towards one which takes advantage of an undocumented and unreliable epiphenomenon? Does your team usually write code whose correctness relies upon undocumented and unreliable correlations, correlations whose magnitudes can vary widely as a result of implementation details?RaviI would first try to find out if the poison isn't colorless, and if that's the case, you could inspect the color of each wine. It would be especially obvious if it's white wine.

Dup LuckFor a solution for 1024 wines, 2 poisons with 40 servants, look at http://math.stackexchange.com/a/779364/138894

Adam LarsonCan be solved with matricies in similar fashion to the given solution... If I get around to making the code, I'll post it!

Anurag PoddarHow is this for a solution? Number bottles as 000,001,002,....998,999 and the servants as 0,1,2,...8,9. On day 0: i th servant drinks from bottles with hunderedth place as i On day 1: i th servant drinks from bottles with tenth place as i On day 2: i th servant drinks from bottles with ones place as i

Problem with this algo: In case the 545th bottle was posioned, we won't be able to determine whether it was 545 or 544. (hence 998 bottles will be available in 36% cases, else 999 bottles) It is given "about 3 weeks". If it were exactly 3 weeks, then there would be no problem.

Advantage: Atmost 3 servants die. (average of 2.71) while in Binary way: At most 9 servants die. (average of ~5)

Thai BuiYour solution is flawed since on the second day you have only 9 servants left and on the third day only 8 servants.

One way is to modify it so that instead of dividing the bottles by 10 on the second day, dividing it by 9, then divided by 8 on the third day. You will need another fourth day if the bottle still cannot be found (because some of the servants drank from two bottles).

In fact the solutions for this problem in general is to divide the bottles into groups similar to a tree with n-branch, with n = 2 ... 10. However, you need to make sure that the person who died on the upper branch will not be the ones to drink bottles on the lower branches. This way, the number of servants died varied from 3 to 10 servants for n = 10 to 2.

adi2293Make combinations of servants (10 comb 5 =252 such combinations possible) and make them drink a bottle.....test for 4 days.

Jayant PatilPoisoned bottle can be spotted using Hamming code method

Danielle SiebenUnfortunately not as strong as the binary solution, I have an alternate which would potentially reduce the deaths to a 3 maximum, and sips from each bottle down from 5 to 3, (down from 5000 to 3000, thus saving 2000 sips).

You name the servants 1-10, and you arrange the bottles in a 10x10x10 array, labeling the rows 1-10 along the x, y, and z axis. At the beginning of week 1, you have the servants take a sip from each bottle in their row along the x-axis. Mid week, you have the servants take a sip from each bottle in their row along the y-axis, and end of week 1, take a sip of each bottle in their row along the z-axis.

The first in that last week to die gives coord one, mid week for coord two (or nobody dies and the first death has the first two coords), and last death of the week for the final coords.

Not as strong and sure as the binary method... but alternate ;)

aaron sulwerthis was a nice alternative, doesn't require binary understanding

Steven TraverYou may cover this contingency when you write "unfortunately not as strong as the binary solution", but your solution won't identify the poisoned bottle in all cases. To illustrate, reduce the number of bottles to nine, and the number of servants to three (the square root of the number of bottles, like in the original problem). Arrange the bottles in a 3x3x3 grid, and let's say the poisoned bottle is in the middle (x-axis) front (z-axis) of the middle (y-axis) layer. Let's call the servants S, K and M. On day 1 of the first week, the servants each drink from all nine bottles in their assigned z-axis layer, S from the back layer, K from the middle layer, and M from the front. So M is poisoned and will die first. Midweek, they each drink from all nine bottles in their x-axis, S from the left, K from the middle, M from the right. So K is poisoned and will die second. At the end of the week, each drinks from their z-axis, S from the top, K from the middle, M from the bottom. K is poisoned again, S is unscathed. When M and K die, it can only be said that the poison is in the middle (x-axis) front (z-axis) of either the middle or bottom layer along the y-axis.

Tarun SharmaAnother useful link on technical forum: http://www.writeulearn.com/king-prisoner-poison-bottle-puzzle/

creativemetaphorThe bottle with the broken seal is the poisoned one. No one would uncork wine bottles 4 weeks in advance of a party. :P

Ravi TrivediI would assume that someone involved in a plot to kill a king has the means to reseal a wine bottle haha.

SalutariusReminds me of a very geeky joke:

A geek teaching at school: "Suppose we have 1000 apples. Or let's take a round number... Suppose we have 1024 apples."

Shaheen(sum of 2^(n-1)) th bottle is poisoned, where n is the number of the died servant. for example, if 999th botlle is poisoned, then died servents are 1,2,3,6,7,8,9 and 10 ==> 1+2+4+32+64+128+256+512=999

AshutoshHey guys there can be another solution for this riddle.Firstly suppose that each bottle is titled. Divide 1000 bottles in group of 100's than there are 10 1st group type and all these 1st groups are further divided into 10 2nd group types and further these are divided into 10 3rd group types. Now let each servant firstly sip 100 bottles from a particular 1st group type .Than they sip 10 bottles from remaining 9 (1st group type) and than they sip 1 bottel from remaining 9 (2nd group type). In this way every worker sip's 290 bottles. After 3 weeks there will be 2 servant dead so that we can easily take the intersection of bottle thay drank to get the answer.

jkjoshThe problem with this is that there is that you will end up with identical combinations for different bottles. If servants 1 & 2 die, there's no way to tell if it's because the poisoned bottle is within the 10 that 2 drank within 1's 100, or the 10 that 1 drank within 2's.