Brain-Teaser 718: An eccentric race
From The Sunday Times, 20th April 1975 [link]
After the tea-party Alice persuaded the Mad Hatter, the March Hare and the Dormouse to run with her round a nearby circular track, promising that they should all four win the race by reaching the winning-post at the same moment — so long as they did not vary their speeds!
Round the track were twelve posts equally-spaced a whole number of feet apart, No. 12 being at the start, which was also the finishing-post. At each post one of the Flamingoes was stationed as umpire. We will call them F1, F2, …, F12. F12 acted as starter. The umpires reported as follows:
(1) All four runners maintained their own constant speeds.
(2) F2 noted that Hatter passed Dormouse at his post exactly 30 seconds after the start.
(3) F3 reported that Hare passed Hatter at his post exactly 45 seconds after the start.
(4) F8 said that Hare passed Alice at his post, at which time Alice was passing his post for the third time and Hare for the sixth time.
(5) The umpires reported no more overtakings, although obviously there were others.
The speeds of the four runners, in feet per second, were whole numbers between 5 and 20.
How many laps had they all completed when they all won. And how many seconds did the race last?
This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.
[teaser718]
Jim Randell 12:33 pm on 14 June 2022 Permalink |
I am assuming they all set off from the start at the same time (although this is not explicitly mentioned).
This Python program runs in 55ms. (Internal run time is 326µs).
Run: [ @replit ]
from enigma import (irange, inf, div, divisors, fdiv, printf) # distance units for passing post <n> for the <k>th time dist = lambda n, k: n + 12 * (k - 1) # check velocity <v> passed post <n> at time <t> def check(v, n, t, d): x = div(v * t, d) return (x is not None) and (x % 12 == n) # calculate the laps and time for a race with velocities <vs> def race(vs, lap): # find the slowest speed s = min(vs) # consider total number of laps for the slowest for n in irange(1, inf): # calculate number of laps for the others laps = list(div(v * n, s) for v in vs) if None not in laps: return (laps, fdiv(n * lap, s)) # choose a speed for the Hare (M) for M in irange(7, 20): # Alice (A) passed post 8 for the 3rd time, when the Hare passed it # for the 6th time A = div(M * dist(8, 3), dist(8, 6)) if A is None: continue # choose speed for D for D in irange(5, M - 2): # Dormouse passes post 2 at exactly 30s # consider possible values for d for d in divisors(30 * D): if not check(D, 2, 30, d): continue # choose speed for Hatter (H) for H in irange(D + 1, M - 1): # Hatter passes post 2 at exactly 30s if not check(H, 2, 30, d): continue # Hare and Hatter pass post 3 at exactly 45s if not (check(H, 3, 45, d) and check(M, 3, 45, d)): continue # output solution ((lM, lA, lH, lD), t) = race([M, A, H, D], 12 * d) printf("M={lM} A={lA} H={lH} D={lD}; d={d} lap={lap} -> t={t:g}", lap=12 * d)Solution: At the end of the race the number of laps was: Alice = 8, Mad Hatter = 13, March Hare = 17, Dormouse = 7. The race lasted 180 seconds.
The distance between posts was 15ft, so one lap was 180ft.
The velocity of each participant, expressed in feet per second, is the same as the number of laps run during the race.
LikeLike
Frits 10:57 pm on 15 June 2022 Permalink |
check(M, 3, 45, d) can already be done before the loop over H.
Another idea is to choose H before D and then d must be in the intersection of the divisors of (30 * H) and (45 * H).
LikeLike