240 Barrels of Wine, 5 Slaves and 48 hours Puzzle || Logical Interview Puzzles


Puzzle Details:

240 Barrels of Wine, 5 Slaves and 48 hours Puzzle || 240 Barrels of Wine, 5 Prisoners and 48 hours Puzzle Details: You have 240 barrels of wine, one of which has been poisoned. After drinking the poisoned wine, one dies within 24 hours. You have 5 slaves whom you are willing to sacrifice in order to determine which barrel contains the poisoned wine. How do you achieve this in 48 hours?

 Solution 

The number system we generally use is base 10, or decimal system. I am assuming that the reader is familiar with ternary system (base 3). a number can be represented in multiple ways, such as base10, base2, base8, similarly a number can also be represented, in base 3.

base 3 uses only, 0 1 and 2 to represent any number. If you are not familiar this is easy, binary system uses 0 and 1 to represent the number whereas ternary system uses 0 1 and 2 to represent the number. conversion technique remains same for binary and ternary systems.

Let the barrels be numbered from 1 to 240, this is represented in base 10. The same number can be represented in base 3 from, 00001 to 22220. Here 00001 represents number 1 whereas as 22220 represents 240. hence, there are 3 digits in ternary system, corresponding to 3 outcomes, in the given problem for each slave. 

let’s assign the digits to the outcomes, when it is 0 the slave does not die, when 1 the slave dies within the first 24 hours, when 2 the slave dies in the last 24 hours

Digit

Outcome

0

The slave does not die

1

The slave dies within the first 24 hours (00 to 24)

2

The slave dies in the last 24 hours (24 to 48)

 

now arrange 5 slaves and let’s give the wine from each barrel to the slaves, convert each number associated with the barrel to its equivalent base 3 presentation which will be 5-digit representation.

Assume for Barrel 139

here barrel number is 139 which is represented in base 10 and its equivalent base3 representation is 12011, you can use online calculator to convert the number from base10 to base 3 representations.

HERE

3rd digit is 0, so don't feed slave 3 from this barrel.
1st, 4th and 5th digits are 1, so feed slave number 1,4 and 5 from this barrel at time t=0. 2nd digit is 2, so feed slave 2 from this barrel at time t=24.

if slave 1 4 and 5 dies at first 24th hour and slave 2 dies at 48th hour then barrel 139 is poisonous.

Consider one more Barrel 231

Here barrel number is 231 which is represented in base 10 and its equivalent base3 representation is 22120. If we take barrel number 231 (base 10) = 22120 (base 3) 

5th digit is 0, so don't feed slave 5 from this barrel.
3rd digit is 1, so feed slave number 3 from this barrel at time t=0.
1st, 2nd and 4th digits are 2, so feed slave number 1,2 and 4 from this barrel at time t=24.

if slave 3 dies at first 24th hour and slave 1 2 and 4 dies at 48th hour then barrel 231 is poisonous.

with these simple steps we can find which barrel is poisonous, based on which slaves die.

one more Example: If slave numbers 2 and 4 die in the first 24 hours, and slave 3 dies in the next 24 hours, then…. Barrel number 01210 (base 3) which is base 3 representation and its equivalent base 10 representation is 48 hence barrel 48 is poisonous in this case.

You may like these posts:

No comments:

Post a Comment