You are given 3 tiny empty unmarked volumetric flasks of capacities 11 ml, 14 ml, and 18 ml. Because they are unmarked, you can only pour water from one flask to another. Until the initial flask is empty or the other is full. What is the minimum number of moves to fill up 16 ml of water into the 18 ml flask?
Details and Assumptions
What is a "move"?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
How would you justify that is the minimum number of steps?
Log in to reply
Short answer : I don't know. I was hoping for someone to post a mathematical solution.
Long answer : I basically branch out all possible few initial steps and eliminate all "circular" branches. I read somewhere (I forgot the source) that this type of problem can be solved using Bézout's identity. I didn't understand most of what they are talking about. If I were to try to explain the math behind it: the "gaps" between the three numbers { 1 1 , 1 4 , 1 8 } are { 3 , 4 , 7 } . And I find the gaps between these six numbers are { 4 , 7 , 8 , 1 1 , 1 4 , 1 5 , 1 8 } . Repeat the process until I get the element { 1 6 } in the set. Then I work backwards to get the answer. My working appears flimsy at best so I refrained from justifying a mathematical solution.
Log in to reply
This is not the minimum step i can prove that :-
(1)0,0,18
(2)11,7,0
(3)4,14,0
(4)4,0,14
(5)4,14,14
(6)4,12,18
(7)4,12,0
(8)0,0,16
Log in to reply
@Sanatan Samkalp – Your math looks wrong from step 5 to 6. How does the 14ml beaker lose 2ml while the 18ml beaker gains 4ml?
Log in to reply
@Kevin Luddy – Does step 2, pouring into two different beakers, constitute just a single move?
If so I can do it in 10!
Step 6 is incorrect. It does not balance, as Kevin mentioned.
18- 11 = 7 this is 2 steps
14-11 = 3, 7 + 3 =10 this is 3 steps
14-11 = 3, 10 + 3 = 13 this is 3 more steps
14-11 = 3, 13 + 6 = 16 this is 3 more steps.
Total steps, 11
A spin off, i vote that repitition is far easier (11,0,0) (0,11,0) (11,11,0) (8,14,0) (0,14,8) (0,0,8) (11,0,8) (0,11,8) (11,11,8) (8,14,8) (0,14,16)
where does 13 come from in last two count.
Wow grt (y)
What happened after step 7 ?
Log in to reply
I empty the 1 4 m ℓ beaker.
He emptied both of the smaller flasks into the last one.
nice one pi.
01) 00-00-11 02) 00-11-11 03) 00-11-11 04) 00-14-08 05) 08-14-00 06) 08-00-00 07) 08-00-11 08) 08-11-00 09) 08-11-11 10) 08-14-08 11) 16-14-00 Hit and trial
After u got 8 in the 18 flask if u do the same steps again u will get 16 in the 18 flask faster (less than that by 1 step)
This can be solved in 8 moves
Fill 18
Dump 18 into 3 (leaving 15ml in 18)
Dump 18 into 14 (leaving 1ml in 18)
Dump 18 into 11 (leaving 1ml in 11)
Fill 18
Empty 3
Dump 18 into 3 (leaving 15ml in 18)
Dump 11 into 18 (leaving 16ml in 18)
Log in to reply
Dump 18 into 3? I don't have a flask that can measure 3ml.
if any1 can prove me wrong :-
(1)0,0,18
(2)11,7,0
(3)4,14,0
(4)4,0,14
(5)4,14,14
(6)4,12,18
(7)4,12,0
(8)0,0,16
Here is my attempt for a mathematical proof of why Pi Han Goh's method is optimal:
First, trying to solve the equation 11a+14b+18c= 16 for a, b and c integers: We get that the smallest possible absolute values are a=3, b=-2, c=0
I'm not sure how to show that these are the smallest coefficients, but one way is a proof by exhaustion, i.e, you prove that it is not working for values lower than that by showing each case one by one.
This is the basic algorithm:
Start by taking water in the 11l flask and start pouring towards the 14l flask whenever possible. Store the newly measured quantities in the 18l flask. Express those quantities in the form 11a+14b too. If a possible addition or subtraction operation can be achieved that will take a towards 3 and b towards -2, then it needs to be done.
Note that a = 4 .
I started out with something like this. However, after looking at Pi Han's solution, I realized that I didn't account for being able to pour away 'random' amounts of water. For example, in this step 1 1 , 3 , 8 → 1 1 , 0 , 8 , he poured away 3 liters of water. This thus screws up the assumption that we must have 1 1 a + 1 4 b + 1 8 c = 0 .
If we make the assumption that you can only pour away full beakers, I still can't completely justify that there needs to be 11 steps. We have
This gives us 9 steps. The additional steps comes in because it can take 2 or more steps to empty out the 11ml beaker, but I'm uncertain how to quantify that a step is wasted. My process is as follows
1) 11, 0, 0
2) 0, 11, 0
3) 11, 11, 0
4) 8, 14, 0 (this is where a step is wasted)
5) 8, 0, 0
6) 0, 8, 0
7) 11, 8, 0
8) 5, 14, 0 (this is where a step is wasted)
9) 0, 14, 5
10) 11, 14, 5
11) 0, 14, 16
Log in to reply
My solution was: (0, 0, 0)-(11, 0, 0)-(0, 11, 0)-(11, 11, 0)-(8, 14, 0)-(8, 0, 0)-(0, 8, 0)-(11, 8, 0)-(5, 14, 0)-(0, 14, 5)-(11, 14, 5)-(0, 14, 16), the same as yours. With the assumption you can only pour away full beakers, I can show this is optimal. That said, the solution is a computer proof. I generate a graph where each node is a possible state of the jugs. So, each of the stages above is a node, and there are clearly many more. I only include states where all but one of the jugs is either completely full or empty. Then, I add arcs to the graph, corresponding to each move (each arc has weight 1). I don't include pouring away "random" amounts of water (maybe I'll add this and get back to you). So, now, each possible move and state is on the graph. I then use Dijkstra's algorithm to find the shortest route from (0, 0, 0) to any of (0, 0, 16), (11, 0, 16), (0, 14, 16), (11, 14, 16).
Results:
Quickest route from (0, 0, 0) to (0, 0, 16) is along arcs (0, 0, 0)-(11, 0, 0)-(0, 11, 0)-(11, 11, 0)-(8, 14, 0)-(8, 0, 0)-(0, 8, 0)-(11, 8, 0)-(5, 14, 0)-(0, 14, 5)-(11, 14, 5)-(11, 0, 5)-(0, 0, 16) with weight 12 Quickest route from (0, 0, 0) to (11, 0, 16) is along arcs (0, 0, 0)-(0, 14, 0)-(0, 0, 14)-(0, 14, 14)-(0, 10, 18)-(10, 0, 18)-(10, 0, 0)-(10, 14, 0)-(11, 13, 0)-(11, 0, 13)-(11, 14, 13)-(0, 14, 13)-(11, 14, 2)-(11, 0, 16) with weight 13 Quickest route from (0, 0, 0) to (0, 14, 16) is along arcs (0, 0, 0)-(11, 0, 0)-(0, 11, 0)-(11, 11, 0)-(8, 14, 0)-(8, 0, 0)-(0, 8, 0)-(11, 8, 0)-(5, 14, 0)-(0, 14, 5)-(11, 14, 5)-(0, 14, 16) with weight 11 Quickest route from (0, 0, 0) to (11, 14, 16) is along arcs (0, 0, 0)-(11, 0, 0)-(0, 11, 0)-(11, 11, 0)-(8, 14, 0)-(8, 0, 0)-(0, 8, 0)-(11, 8, 0)-(5, 14, 0)-(0, 14, 5)-(11, 14, 5)-(0, 14, 16)-(11, 14, 16) with weight 12
Thus, the shortest way to get to having 16ml in the 18ml beaker is in 11 moves.
Log in to reply
Indeed. I agree that it is essentially tedious case cracking of numerous scenarios, which is best left to a computer.
How do I show that this is optimal?
solved it in 8 steps
0,0,18
0,14,4
11,3,4(mark 2nd flask with 3ml)
11,0,7
8,3,7
8,0,10
5,3,10
5,0,13
2,3,13
2,0,16
So answer is 10
YOU CAN'T MARK THE BEAKERS!
Log in to reply
18- 11 = 7 this is 2 steps
14-11 = 3, 7 + 3 =10 this is 3 steps
14-11 = 3, 10 + 3 = 13 this is 3 more steps
14-11 = 3, 13 + 6 = 16 this is 3 more steps.
Total steps, 11
How did you get the question right to be able to write a solution? The answer is 1 1 .
Log in to reply
@Trevor B. you used your brain that to think that we are only able to write a solution when our answer is write, but you didn't used your brain completely as we get 3 tries and in the 1st try he might have tried 10 but got it wrong, so then in 2nd or 3 rd try he might have tried 11 to get it right by guess work or something like that............ So use your brain wisely :-)
Log in to reply
A Brain? I do not have one. Can I buy one on ebay?
Even so if you cannot justify your answer, your solution is wrong. @Kunal Mandil
Log in to reply
@Mardokay Mosazghi – @Mardokay Mosazghi for your kind information i haven't posted any solution so how it can be wrong...... Please let me know......
Log in to reply
@Kunal Mandil – If you actually don't think the answer is right, report the problem.
Buddy we dont have any pen to mark
i solved it in 8
step1) 11,0,0 step2) 0,0,11 step3) 11,0,11 step4) 0,11,11 step5) 11,11,11 step6) 8,14,11 step7) 8,0,11 step8) 0,8,11 step9) 11,8,11 step10) 5,14,11 step11) 0,14,16
If you can pour into two beakers in one step, then step 10 can be omitted.
-This is my solution :) - 0.0.0
bro it's solved in 8
0,0,0 11,0,0 0,11,0 11,11,0 8,14,0 0,14,8 0,0,8 11;0,8 0,11,8 11,11,8 8,14,8 0,14,16
Problem Loading...
Note Loading...
Set Loading...
0 , 1 1 , 0 , 1 1 , 8 , 0 , 1 1 , 1 1 , 0 , 0 , 1 1 , 0 , 0 0 1 1 1 1 1 4 1 4 3 0 1 1 1 4 3 3 , 0 , 0 , 0 , 0 , 0 , 8 , 8 , 8 , 8 , 5 , 5 , 1 6