Brain-Teaser 489: [Railway journeys]
From The Sunday Times, 11th October 1970 [link]
The All-Go railway runs from Alby to Goby over 20 miles away. Let us say it goes from A to G, and on the way you stop at B, C, D, E and F in that order.
All the distances between stops are different from one another and all are less than 8 miles, yet it is possible to make journeys of 1 mile, 2 miles, 3 miles and so on up to 18 miles by picking the right stations.
The distance from A to B is less than the distance from F to G.
How many miles from A are B, C, D, E, F and G?
This puzzle was originally published with no title.
[teaser489]
Jim Randell 12:15 pm on 25 July 2019 Permalink |
(See also: Teaser 1986).
This Python program runs in 220ms.
Run: [ @replit ]
from enigma import (subsets, irange, tuples, csum, join, sprintf as f, printf) # required distances rs = set(irange(1, 18)) # choose the lengths of the 6 segments, AB BC CD DE EF FG for ss in subsets(irange(1, 7), size=6, select='P'): (AB, BC, CD, DE, EF, FG) = ss if not (AB < FG): continue # collect together adjacent segments from 1 to 6 ds = set(sum(t) for k in irange(1, 6) for t in tuples(ss, k)) if not rs.issubset(ds): continue printf("{cs} [ss={ss}]", cs=join((f("A{x}={d}") for (x, d) in zip("BCDEFG", csum(ss))), sep=" "))Solution: The distances (in miles) are: A→B=2, A→C=7, A→D=14, A→E=15, A→F=18, A→G=24.
The distances between stations are:
So as well as being able to make all the distances from 1 to 18, we can also make distances of 22 (B to G) and 24 (A to G).
LikeLike