Teaser 2542: Two routes
From The Sunday Times, 12th June 2011 [link] [link]
A line of equally spaced poles is marked in order with odd numbers, 1, 3, 5, etc. Directly opposite is a parallel line of an equal number of poles with even numbers, 2, 4, 6, etc. There are fewer than 100 poles. The distance in metres between adjacent poles is a two-digit prime; the distance between opposite poles is another two-digit prime.
Jan walks the route 1-2-4-3-5, etc to reach the final pole. John walks the odds 1-3-5, etc to the last odd-numbered pole; then walks diagonally to pole 2; then walks the evens 2-4-6, etc, also finishing at the final pole. Jan’s and John’s routes are of equal length.
How many poles are there?
News
This completes the archive of puzzles from the book The Sunday Times Brain Teasers 2 (2020).
As far as I am aware, there are 927 Teaser puzzles that have been published across 9 books. So far I have posted 835 (= 90.1%) of these puzzles to the S2T2 site, and have complete coverage of 6 of the books. I will continue working on the 3 remaining books (published in 1974, 1981, 1994).
[teaser2542]










Jim Randell 7:27 am on 10 June 2025 Permalink |
If the distance between adjacent odd (and even) poles is a, and the distance between the two rows is b, and there are k gaps between poles in a row (i.e each row has (k + 1) poles, so in total there are (2k + 2) poles), then:
And these two distances are equal when:
It also seems the setter intends that Jan and John are to arrive at the same final pole, so we require k to be a multiple of 2. (Although this condition does not eliminate any candidate solutions).
The following Python program runs in 71ms. (Internal runtime is 11.4ms).
from enigma import (irange, primes, subsets, ihypot, printf) # consider (different) 2-digit primes a, b for (a, b) in subsets(primes.between(10, 99), size=2, select='P'): # consider number of gaps for k in irange(2, 48, step=2): ak = a * k h = ihypot(ak, b) if h is None or ak + h != b * (k + 1): continue # output solution printf("k={k} a={a} b={b} -> {n} poles", n=2 * k + 2)Solution: There are 74 poles.
Adjacent poles are separated by 19 m, and the rows are separated by 37 m.
Jan walks 19×36 + 37×37 = 2053 m.
John walks 2×19×36 + hypot(19×36, 37) = 2053 m.
With additional analysis we can show:
Where a and b are prime.
Hence:
This allows us to consider fewer cases:
from enigma import (primes, div, printf) for a in primes.between(10, 99): k = 2 * a - 2 n = 2 * k + 2 if not (n < 100): break b = k + 1 if not (b in primes): continue # output solution printf("k={k} a={a} b={b} -> {n} poles")LikeLike
Frits 2:40 pm on 10 June 2025 Permalink |
See also [https://brg.me.uk/?page_id=3746#comment-578]
LikeLiked by 1 person
Ruud 6:01 pm on 10 June 2025 Permalink |
import itertools import sympy import math primes = [i for i in range(10, 100) if sympy.isprime(i)] for a, b in itertools.product(primes, primes): for n in range(4, 100): n1 = int((n - 1) / 2) n2 = int(n / 2) d_jan = n1 * a + n2 * b d_john = n1 * a + n1 * a + math.sqrt((n1 * a) ** 2 + b**2) if d_jan == d_john: print(a, b, n)LikeLike