You have two drums of capacity 8 litre and 5 litre and a resource of oil, can you use these two drums to give 1 litre, 2 litre, 3 litre, 4 litre, and 6 litres and 7 litres to any customer? If yes, then how? Note that there is no mark of litres on the drums.
-
anyone seen Die Hard w a Vengeance? :) – Adam Oct 18 '17 at 20:07
2 Answers
The answer is
yes, you can, mainly because 5 and 8 are relatively prime (and the required volumes are less than the combined volume of the drums)
Reasoning:
1. use the procedure for 6. below, empty [5], put 5 liter in [5] (then it's full) and you're left with 1 liter in [8].
2. fill [5], empty it in [8], fill [5] again, put 3 liter in [8] (then it's full) and you're left with 2 liter in [5].
3. fill [8], put 5 liter in [5] (then it's full) and you're left with 3 liter in [8].
4. use the procedure for 7. below, fill [5], put 1 liter in [8] (then it's full) and you're left with 4 liter in [5].
6. use the procedure for 3., empty [5], put the 3 liter from [8] in [5], fill [8], put 2 liter in [5] (then it's full) and you're left with 6 liter in [8].
7. use the procedure for 2., empty [8], put the 2 liter from [5] in [8], fill [5] and empty it in [8]. You're left with 7 liter in [8].
- 28,033
- 9
- 96
- 142
Fill up the 5 liter, and pour all of it into the 8 liter.
Fill up the 5 liter again, and pour into the 8 liter until it's full. There will be 2 liters left in the 5 liter. Two liter check!
Empty the 8 liter, and pour the two liters from the 5 liter into the 8 liter.
Fill the 5 liter, and pour it all into the 8 liter, which now contains 7 liters. 7 liter check!
Empty the 5 liter, and refill it. Pour into the 8 liter until it's full. There will be 4 liters left in the 5 liter. 4 liter check!
Empty the 8 liter, and pour the four liters from the 5 liter into the 8 liter.
Fill the 5 liter, and pour into the 8 liter until it's full. Now the 5 liter will contain 1 liter. 1 liter check!
Now, we have measured 1, 2, 4, and 7 correctly. We just need 3 and 6.
Fill the 8 liter, and pour into the 5 liter until it's full. Now we have 3 left over in the 8 liter. 3 liter check!
Empty the 5 liter out, and pour the remaining 3 liters into it.
Fill the 8 liter, and pour into the 5 liter until it's full. Now we have 6 left over in the 8 liter 6 liter check!
- 382
- 3
- 14