Teaser 2502: [Swimming lengths]
From The Sunday Times, 5th September 2010 [link] [link]
John and Pat were swimming at the pool. John started at the deep end at the same time as Pat started at the shallow end, each swimming lengths at their own steady speed. They passed each other on their first lengths and then passed each other again on their second lengths. It turned out that the length of the pool was a multiple of the distance between those first two passing points. John got out of the water after completing 48 lengths. At that moment Pat had also completed a whole number of lengths.
How many?
This puzzle was originally published with no title.
[teaser2502]
Jim Randell 8:11 am on 29 July 2025 Permalink |
(See also: Enigma 799).
Suppose J takes 1 unit of time to swim a length, and P takes p units of time to swim a length.
And after J has completed 48 lengths, P has completed n = 48/p lengths, which is a whole number.
For them to pass on their first and then second lengths we have:
Hence:
For a given n value, we can calculate the crossing positions using a time/distance graph:
And then look for values where the distance between the positions divides exactly into the pool length.
This Python program runs in 74ms. (Internal runtime is 4.6ms).
from enigma import (irange, rdiv, line_intersect, catch, printf) # positions for J after lengths 0, 1, 2; P after length 0 (J0, J1, J2, P0) = ((0, 1), (1, 0), (2, 1), (0, 0)) # consider number of lengths completed by P at t=48 for n in irange(25, 95): p = rdiv(48, n) # positions for P after lengths 1, 2 (P1, P2) = ((p, 1), (2*p, 0)) # calculate crossing position during first two lengths i1 = catch(line_intersect, J0, J1, P0, P1, internal=1, div=rdiv) i2 = catch(line_intersect, J1, J2, P1, P2, internal=1, div=rdiv) if i1 is None or i2 is None: continue ((t1, d1), (t2, d2)) = (i1.pt, i2.pt) # pool length is an exact multiple of the distance between the positions if d1 == d2: continue k = rdiv(1, abs(d1 - d2)) if k % 1 != 0: continue # output solution printf("n={n} [p={p} k={k}]")Solution: Pat had completed 80 lengths.
So Pat completes a length in 48/80 = 3/5 the time it takes John. And the distance between the crossing positions is exactly 1/2 the length of the pool.
We have:
LikeLike
Frits 2:27 pm on 30 July 2025 Permalink |
# L = length of the pool # 1st passing # 0 j1*L p1*L L j1 + p1 = 1 # |---------------+---------------------------| # speed ratio r1 = p1 / j1 # 2nd passing # 0 L # |-------------------------------------------| # j2*L p2*L j2 + p2 = 1 # |------------------------------------+------| # speed ratio Pat / John # r = n / 48 # j1 = 1 / (r + 1) # 2nd passing: distance that P swam = r * (distance that J swam) # L + j2.L = r.(L + p2.L) or 1 + j2 = r.(2 - j2) or j2 = (2.r - 1) / (r + 1) # j2 = (2 * r - 1) / (r + 1) # 24 < n < 96 # n must be a multiple of 4 as denominator in formula below is a multiple of 4 for n in range(28, 96, 4): # distance between those first two passing points > 0 if n == 48: continue # L = multiple of the distance passing points = m * (abs(j1 - j2) * L) # if (r + 1) % (2 * r - 2): continue if (n + 48) % (2 * n - 96): continue print("answer:", n)LikeLike
Frits 3:05 pm on 30 July 2025 Permalink |
“n” can even be proven to be a multiple of 16.
LikeLike