SRL Archive - NOTA

How to measure 20liters of water? (brainpuzzle)


marpis

2009-05-08 20:11:29

You have 2 cans and one big barrel.
The other can is 9 liters, the other is 15 liters.
You must measure 20 liters of water to the big barrel.

BUT: You must keep the amount of water accurate, so you cannot put 'half a can' in to the barrel.
To help the task, i've cut the bottom of the barrel away so the maximum capacity is now infinite.

How do you do that?
(accurate explanations are required. plain answer is not enough)

First one to solve this gets a smarty-cookie that can be attached to your signature. It makes all other forum users obey.
This time it will be cool enough to put in to your sig ;)
Right answer:
lets make a function of this:
15x + 9y = 20
3(5x + 3y) = 20
We see that the left side is always divisible by 3, and (5x +3y) is always a whole number, there is no whole number solution!

congratulations to
mixter!

tarajunky

2009-05-08 21:20:10

What's the maximum capacity of the barrel?

Is it like 25 liters, or 1,000 liters?

marpis

2009-05-08 21:37:41

From: tarajunky
What's the maximum capacity of the barrel?

Is it like 25 liters, or 1,000 liters?


its like 10^10^100 liters

Floor66

2009-05-08 21:59:27

So unlimited actually. (not really but 20 litres (UK way <3) will fit it)

mixster

2009-05-08 22:03:55

Due to 15 and 9 both being visible by 3, all numbers produced will be divisible by 3. Unless the barrel itself has a volume non divisible by 3, then it would be impossible to make a number that is not divisible by 3, which 20 is.
One way to prove that it cannot be done using whole numbers, is to run this script which bruteforces the equation 9x + 15y = 20, with x representing the number of 9 liter cans used and y the number of 15 liter cans used.

var
x, y, r: Integer;
begin
for x := -10 to 10 do
for y := -10 to 10 do
begin
r := (9 * x) + (15 * y);
Writeln(IntToStr(x) + ',' + IntToStr(y) + ' = ' + IntToStr(r));
if (r = 20) then
TerminateScript
end;
end.
You can expand the loop range, but even trying on -999 to 999 does not provide a solution. Therefore, it is only possible if the barrel itself has a set limit. If you actually want that limit provided to be used, then there probably is a way, though it would be much easier if it were a more reasonable number to work with.

marpis

2009-05-09 00:36:58

From: mixster
Due to 15 and 9 both being visible by 3, all numbers produced will be divisible by 3.


That is absolutely correct!! :)

i give you your cookie in a couple of days

ritchmister

2009-05-09 01:24:47

thats not fair it was a trick! :p
i sat there for ages and eventually gave up, closest i got was 19.5 hehe, gj anyways :rolleyes: