# Puzzle anyone

When one is lighted it burns out in 1 hour.

when the other is ligthed it burns out in half hour.

Measure 45 minutes using these ropes .

Ropes are uneven in density and do not burn out evenly.

[This message has been edited by Pranav Jaidka (edited May 30, 2001).]

I forgot to mention that the ropes are not even in density and they do not burn out UNIFORMLY .......makes it tougher but its possible.

.

.

.

You were close though

[This message has been edited by Pranav Jaidka (edited May 30, 2001).]

[This message has been edited by Pranav Jaidka (edited May 30, 2001).]

Sheriff

As a variation, try to measure a length of 37.5 minutes.

"I'm not back." - Bill Harding, *Twister*

SCJP

Visit my download page

Sheriff

There's also a way to measure 7.5 minutes, though to do it exactly you technically need to perform an infinite number of steps. And I'm assuming it takes zero time to light something. If I also have a knife which can cut the cord in zero time, I can measure 10 minutes as well. And by combining these techniques and others like them, plenty of other times are achievable - 67.5, 3.75, 35... the list is endless, really. Categorizing all the possibilities would be a nifty programming problem in itself, I imagine...

"I'm not back." - Bill Harding, *Twister*

Oh, and just for the record, that's the solution I came up with by myself before I peeked. (So I'm biased but right anyway)

Peter <--- patting himself on his back for being so smart

Sheriff

Distance between two towns is 600 km. A train goes from the town �A� to town �B� with a speed 120 km an hour. At the same time another train starts to move from town B to A with a speed 180 km. But these are not all bad news yet. Worse, that at the same time a fly starts from the train �A� (let�s call it so) ant takes a direction to the train �B�. When she meets the train �B�, she immediately turns back and flies to the train �A� again. And so on. Until the train meets. Question: What distance will the fly finally make if her speed is 200 km/hour? (Fly's final destiny can be disregarded )

Sorry for bad English and wrong measurement units.

[This message has been edited by Mapraputa Is (edited June 01, 2001).]

Uncontrolled vocabularies

"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet

That is impossible. Since train A is faster than the fly, train A will meet train B before the fly does. Once the fly gets to train B it will never be able to catch up with train A before it gets to its destination.

[This message has been edited by Sahir Shibley (edited June 01, 2001).]

Sheriff

I changed my post above for not to confuse others.

[This message has been edited by Mapraputa Is (edited June 01, 2001).]

Uncontrolled vocabularies

"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet

1>Trains travel at a relative velocity of 120+180km per hour =300 Km per hour .(because they are traveling towards each other)

2)Since time = distance/velocity the time after which they meet is 600/300 = 2 hours.

3) 2 hours is the time the Fly needs to keep flying .

So the distance it will travel is velocity * time = 200*2 = 400 km .

ANSWER 400 KM.

Hows that Map ......hope thats what you are asking for.

Sheriff

*was*impossible using the numbers Map originally posted. Map later changed her numbers to make the puzzle solvable. See the "edited by" line in her post? Also her later statment that she changed the values?

Map- see, you can't avoid causing confusion.

"I'm not back." - Bill Harding, *Twister*

However coming back to the Rope problem Randall is right about lighting both ends (That is all we can do for the time interval).I dont think cutting the rope would help in measuring any other time intervals because of the non uniform desity.

[This message has been edited by Pranav Jaidka (edited June 01, 2001).]

[This message has been edited by Pranav Jaidka (edited June 01, 2001).]

Start by lighting the 1-hr rope on one end and the 30-min rope at both ends at the same time.

When the 30 min rope burns out in 15 minutes, you'll have 45 minutes left on the 1-hr rope.

Light the other end of the now 45-minute rope (now both ends are lighted) and it burns out in 22.5 minutes.

Entire process takes 37.5 minutes

Junilu

Junilu - [How to Ask Questions] [How to Answer Questions]

Sheriff

Guys, you all are right: Sahir, Pranav, and Jim!

It is only Map who makes mistakes here!

Pranav, your solution is correct.

I wonder how many people try to solve this by callculating sum of ... series? (series? Jim, is that how you, US citizens call it?) At least, I observed one with my own eyes!

There is also an anecdote about this puzzle. Once one famous mathematician was given this puzzle and after about 30 second of thinking he said an answer. �Impossible!� � replied the asker. �Most people I know tried to sum endless series!� �Why amazement?� � said our famous mathematician - �that�s what I did!�

Conclusion: if you cannot count fast enough, think!

Uncontrolled vocabularies

"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet

I don't see how you can measure out less than 15 minutes given just the two ropes. Are you assuming you have an infinite supply of 1-hr ropes and 30-minute ropes? If you only have the two ropes, the shortest period of time you could measure would be 15 minutes and the most would be 1.5 hrs. Am I missing something

Junilu

Junilu - [How to Ask Questions] [How to Answer Questions]

Junilu

[This message has been edited by JUNILU LACAR (edited June 01, 2001).]

Junilu - [How to Ask Questions] [How to Answer Questions]

Sheriff

Let�s move our �tomorrow� monk one day back and imagine that we have two monks: one going up and one going down (the latter simply repeat �tomorrow�s� path). Then it is obvious

[This message has been edited by Mapraputa Is (edited June 01, 2001).]

"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet

Map got the answer. Now the problem is for you to figure out how to see it.

Junilu

Originally posted by Pranav Jaidka:

Is that the answer Map ...Frankly i have no clue if thats possible...unless he has a Rolex .

For me he can have any number of random locations for him to be present at any time of the day

Junilu - [How to Ask Questions] [How to Answer Questions]

Sheriff

Map- yes, the term is "series". The classic time to show someone this puzzle is when they have just been learning how to calculate infinite series like this one - they will of course interpret the problem that way and spend some effort getting the solution. Then you ask the same problem to a passing third-grader (OK, a

*smart*third-grader) and watch the series-summer's reaction when the third-grader solves the problem the simple way.

Junilu- good solution for the 37.5, congratulations! For the other times, no, I'm only assuming one 30-min rope and one 60-min rope. I agree that 1.5 hours is the maximum time possible, but there is a trick (or group of tricks) which will allow times smaller than 15 min, such as 7.5, 10, 5, 3.75, and many more.

[This message has been edited by Jim Yingst (edited June 01, 2001).]

"I'm not back." - Bill Harding, *Twister*

Sheriff

**The classic time to show someone this puzzle is when they have just been learning how to calculate infinite series like this one - they will of course interpret the problem that way and spend some effort getting the solution. Then you ask the same problem to a passing third-grader (OK, a smart third-grader) and watch the series-summer's reaction when the third-grader solves the problem the simple way.**

Jim, both your cases are extreme. Obviously, even smart third-grader cannot sum series, and obviously, math students studying series have certain

*pattern*in mind. Pattern is a key word here. My interest is to figure out how people think in situations, when there is a choice of patterns. Why some people think �better� than others? One thing, they seem do not look over all possible (including wrong) solutions, they �feel� good ones. The question is simple: how do they feel them? Perhaps they have better �superpatterns�, allowing them to choose �rigth� solving patterns and thus reduce solution space. Jim, are still listening? You can continue from this place

"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet

Sheriff

[This message has been edited by Mapraputa Is (edited June 01, 2001).]

"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet

I must admit I made the same mistake. I got the answer 399.93074792243766. Taking the sigma route isnt that difficult if you have a few dirty tricks up your sleeve.

<pre>

public class Fly{

private double accum = 0;

boolean flipflop = true;

private double fSpeed = 0, aSpeed = 0, bSpeed = 0;

public Fly(double distance, double aVelocity , double bVelocity , double fVelocity){

aSpeed = aVelocity;

bSpeed = bVelocity;

fSpeed = fVelocity;

while(true){

distance = iterate(distance);

if(distance < 1) break ;

}

}

public double getDist(){

return accum;

}

private double iterate(double distance){

double result = 0;

if(flipflop){

flipflop = false;

result = (distance * fSpeed) / (fSpeed + bSpeed);

accum = accum + result;

result = result - ((result * aSpeed) / fSpeed);

}

else {

flipflop = true;

result = (distance * fSpeed) / (fSpeed + aSpeed);

accum = accum + result;

result = result - ( (result * bSpeed) / fSpeed);

}

return result;

}

public static void main(String[] args) {

Fly f = new Fly(600 , 120 ,180 ,200);

System.out.println(f.getDist());

}

}

</pre>

Well The difference between my answer and 400 is only 0.06925207756234,

which gives me an error factor of 0.017313019390585% . Perhaps if I had written this in Visual Basic I may have got 400 (Dont take that seriously. Just trying to provoke you guys)

PS. If I have breached protocol by posting code in "Meaningless Drivel" , my sincerest apologies.

PPS. I have replaced the "quick and dirty" fly with an extensible and reusable, object oriented fly for Thomas Paul.

[This message has been edited by Sahir Shibley (edited June 02, 2001).]

Junilu

Junilu - [How to Ask Questions] [How to Answer Questions]

Sheriff

�An extensible and reusable, object oriented railroad fly� was ingenious! And such an outstanding exactness! Thomas Paul can be proud of you.

Junilu, �at sunrise� is a monastic equivalent to our �at 6:00pm�

"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet

Sheriff

<code><pre> if(distance < 1) break ;</pre></code>

with

<code><pre> if(distance <= 0) break ;</pre></code>

Or are 1 and 0 considered equivalent in VB?

Junilu- I really don't think it's possible to determine the time that the positions are the same. I am assuming that the monk's speeds on the second day are independant of the speeds on the first day; the only constraint is that the toatl time and total distance are the same. I can make up all sorts of combinations of numbers which yield different answers to the questions of where or when the positions would be the same. Perhaps you're using some other assumptions?

For the rope-burning problems, a hint: to get a time of 7.5 minutes, you only need the 30-min rope. Forget about the other rope.

"I'm not back." - Bill Harding, *Twister*

Originally posted by Jim Yingst:

Junilu- I really don't think it's possible to determine the time that the positions are the same. I am assuming that the monk's speeds on the second day are independant of the speeds on the first day; the only constraint is that the toatl time and total distance are the same. I can make up all sorts of combinations of numbers which yield different answers to the questions of where or when the positions would be the same. Perhaps you're using some other assumptions?

For the rope-burning problems, a hint: to get a time of 7.5 minutes, you only need the 30-min rope. Forget about the other rope.

Jim, you're right: there is no way you can determine the time the monk will be at the same spot on both days. I realize now there is a slight difference between the monk problem and the rope-burning problem.

As for the trick you hint at with the instantaneous cutting and lighting: theoretically, it's possible. I know where you are coming from now. For all practical purposes though, 15 minutes is the least amount of time you could measure. It would be fun to watch somebody actually measure out 3.75 minutes or less with that method though. It'd be like the JuggleMaster simulation of a "only God could do it" pattern with 25 balls.

Junilu

Junilu - [How to Ask Questions] [How to Answer Questions]

Sheriff

we divide 30-minute rape in two parts and light them from both ends. They are supposed to burn in 30/4 = 7.5 sec. Now our challenge is to keep all four fires running. So we wait when the first of ropes is burnt, then immediately cut the other one in two pieces and burn them from all two ends again...

Junilu, it is possible - I tried. Of course, now my house is burnt too, but it is not important, as long as we can find a solution

[This message has been edited by Mapraputa Is (edited June 02, 2001).]

"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet

Originally posted by Mapraputa Is:

Junilu, it is possible - I tried. Of course, now my house is burnt too, but it is not important, as long as we can find a solution

Yes, I suppose it is possible in the sense that there comes a point where it won't make a difference to keep cutting and re-lighting ropes anymore (although you have to keep just

**4**ends lighted at the same time to measure 7.5 minutes).

A lot like the problem that asks "Given points A and B, if you start from A and travel half the distance AB in one step, then half the remaining distance on the next step, and half the remaining distance on the next and so on, how many steps will it take for you to get to B?" Theoretically, the number of steps are infinite but I would consider myself practically at B after just a few steps.

Don't you folks have anything better to do on a Saturday afternoon though? My excuse is that my wife and kids are napping and its cold and raining outside.

Junilu

Junilu - [How to Ask Questions] [How to Answer Questions]

Sheriff

*did*say it would take an infinite number of steps to make it exact. And I further specified that I was assuming you could light and cut things in zero time. Because it's true that there are some definite problems with implementing this solution in the real world - but you can get an arbitrarily close approximation to 7.5 minutes before you tire of relighting things, and decide that you're close enough.

Incidentally, you don't actually need to do any cutting for this solution. Just light each rope in what you think is the middle, and it should start burning in both directions. You only need a knife if you want to light an odd number of firses - e.g. for 10 minutes, chop the 30-min in two, and light 3 out of four ends. Make sure there are always three fires burning at any time. Whenever one fire goes out by itself, if there are no other ends currently unlit, find an unused sction of rope, chop it in two, and light one end. If two fires meet and extinguish each other, then just start a new fire somewhere in the middle of still-unburnt segment.

> Don't you folks have anything better to do on a Saturday

> afternoon though? My excuse is that my wife and kids are

> napping and its cold and raining outside.

I'll have you know that I was out finding a new apartment today, thank you. Actually I found two - still need to decide. It's much easier than it would hav been at the beginning of the year or earlier - for some reason, there are a lot more vacancies in Silicon Valley recently. Map, if you need to relocate after burning down your place, give me a call - I'm sure we can set you up.

Junilu- love the Jugglemaster applet. Very cool; thanks for the link. By the way, I gather you're Filipino? Is the "J" in your name pronounced as "H", like in Spanish? Just curious - I like to imagine that I know how to pronounce people's names at least somewhat correctly, even if I never meet them in person. Of course in Map's case, the mispronunciation has taken on a life of its own, but that's another story...

"I'm not back." - Bill Harding, *Twister*

*Pinoy*from Iligan City, Philippines. Looking to make Columbus, OH my home for a while though.

And it's "J" as in "Junior," which I am, as are a lot of other Filipinos. Only my dad (Luis) decided to be creative and melded his name with "Junior". Thanks for asking though.

I never realized this particular forum could be so much fun. Glad I decided to check it out.

Junilu - [How to Ask Questions] [How to Answer Questions]

Sheriff

*impossible*rope. Think again: we have a rope with inconstant speed of burning. So how you can cut a piece of such rope and guarantee it will be burnt in 30 or 60 minutes if not by prior burning?

Actually, that may be possible by measuring

*other*parameters... And if it is possible, we do not need infinite lightenings for measuring 7.5 or 10 or whatever minutes.

"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet

Originally posted by Jim Yingst:

[B]Sahir- the accuracy of your result will improve substantially if you replace

<code><pre> if(distance < 1) break ;</pre></code>

with

<code><pre> if(distance <= 0) break ;</pre></code>

Or are 1 and 0 considered equivalent in VB?

[B]

Yes I see your point. I forgot that the value being tested isn't an integer. Even VB programmers make mistakes

So, after the bugfix, I have an error factor of 0.0000000000001%

Regarding the rope problem. There is a roundabout way to measure 7.5 minutes. Slice the ropes into two sections (provided the reduced thickness doesnt afffect the burn rate. Ideally this can be done with two half hour ropes). Lets call them rope A and B.

1. Burn A at both ends.

2. Burn B at one end

3. When rope A has finished burning rope B has 15 minutes left.

4. Now light the other end of rope B. The remaining part of rope B will finish in 7.5 minutes.

[This message has been edited by Sahir Shibley (edited June 04, 2001).]

Ranch Hand

Sorry I didn't see this sooner. As javaRanch Guru of OO I am required to spend my weekends on top of a mountain answering questions.Originally posted by Mapraputa Is:

�An extensible and reusable, object oriented railroad fly� was ingenious! And such an outstanding exactness! Thomas Paul can be proud of you.

Associate Instructor - Hofstra University

Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog

btw - microsoft uses the rope puzzle during interview =) and this monk thing was used by a philosophy prof. at my school as extra credit on a test (drivel!)

Sorry if that thread was put in the ancient forum history and no one is interested on it, but if there are some people that can help me, I will be very pelasured

I had that 2-rope problem in a job interview last month, with a small variation: each rope burns in 1 hour and I have to find out how to measure 15 min. I discovered it with exactly the same procedure you described here: first I burn 3 points of the 2 ropes, when the 2-points burning rope met I start counting the time and burn the remaining point. When these last points met, I stop counting time and the clock marks 15 min.

So I got the job eheh - but I became curious with that problem because I have a feel I can do it with only ONE rope! But I could not find an "acceptable" answer.

The better I could do was using Einstein's Theory of Relativity, placing me in a referential moving fast in the direction of the rope, making the perception of the time (from my point of view) to reduce to half. So I see the only one rope burning out in 15 min (when both points met) and not 30 min (as measured in the rope referential).

But that need some profound physic knowledge and I would like to find a solution that doesn't need more knowledge than a normal people has.

Do you have any ideas? I read all these posts and I could not find some useful help.

Thank you!

Rui Pinheiro