### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,123)
- misc (2)
- project euler (2)
- puzzle (31)
- site news (43)
- tantalizer (31)
- teaser (3)

### Site Stats

- 168,282 hits

Programming Enigma Puzzles

5 December 2016

Posted by on **From New Scientist #2294, 9th June 2001** [link]

Jane left the campsite and cycled north at her own steady speed. At the same time Mark left the campsite and cycled south at a speed one mile per hour faster than Jane.

An hour later I realised that they had left without their packed lunches. So, at my own steady speed of 10 miles an hour, I cycled after Jane, gave her a packed lunch, turned round and cycled after Mark, gave him a packed lunch, and then turned round and cycled back to the campsite.

The round trip took me 5 hours. How long would it have taken if I had cycled to Mark first and then to Jane?

[enigma1138]

Advertisements

%d bloggers like this:

Analytically:

If I travel at speed

v, to catch up a cyclist travelling at speedx, with a head start ofh(time), then we meet at a distancedand timetwhere:And it takes me the same time to get back, so the total time to deliver the lunch to this cyclist and return is:

Now considering two cyclists with speeds

aandb, to deliver to the first cyclist (and return) would take:And then the second cyclist now has a head start of

h + Ta, so to deliver to him (and return) will take:and the total time is:

We notice that this is symmetrical in terms of

aandb, so in terms of total time it doesn’t matter which cyclist we visit first. And in general this is true regardless of the speeds and head start involved. So without further calculation we know that the answer to the puzzle is 5 hours.Solution:It would also have taken 5 hours to cycle to Mark first, and then Jane.In this particular case we have:

which gives:

We need the smaller solution, as June’s speed must be less than 10 mph in order for us to catch up with her (indeed it must be less than 9 mph in order for us to catch up with Mark, who is travelling 1 mph faster).

However, although it doesn’t make any difference to the overall time (or distance travelled) which cyclist we deliver to first, if we deliver to the slower one first (Jane) then the lunches are delivered sooner:

Visiting the slower cyclist first the packed lunches are delivered at 1h35m and 4h05m after they set out, with the alternative strategy they are delivered at 1h53m and 4h23m.

Here is a numeric program that calculates the speeds of Jane and Mark (using the

find_value()solver from theenigma.pylibrary) and then uses these to compute the time it would have taken to visit them in the opposite order. It runs in 40ms