### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,158)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 177,972 hits

Advertisements

Programming Enigma Puzzles

1 July 2012

Posted by on **From New Scientist #2697, 28th February 2009** [link]

Harey and Tortus decided to race from Harey’s house to school, a distance of a whole number of metres. They each ran at their own steady speed and when Harey reached school, Tortus was over half way there, but still had a two-figure number of metres to go.

The next day they repeated the race, but this time Harey decided to give Tortus a head start equal to the winning margin of the previous day. So Harey walked that number of metres away from his house in the opposite direction to school before the race started. Once again, Harey got to school first, ahead by a two-figure number of metres. The second winning margin had the same pair of digits as the first, but in reverse order.

How far is it from Harey’s house to the school?

[enigma1534]

Advertisements

%d bloggers like this:

Here’s my original Perl solution. It runs in 14ms.

Solution:The distance from Harey’s house to the school is 192 m.And here’s a Python solution (along with the analysis to give the equation for the required distance). It runs in 40ms.