Teaser 3143: Pipe fittings
From The Sunday Times, 18th December 2022 [link] [link]
A plumber had three thin metal pipes with square, rectangular and elliptical cross-sections. In order to fit them into his van, he slid the rectangular pipe inside the elliptical pipe and the elliptical pipe inside the square pipe, before placing the pipe assembly in the van. There are four points where the pipes all touch, as shown in the diagram. The maximum and minimum widths of the elliptical and rectangular pipes and the diagonal width of the square pipe were all even numbers of mm less than 1000, of which one was a perfect square.
What were the five widths (in increasing order)?
[teaser3143]
Jim Randell 5:20 pm on 16 December 2022 Permalink |
If we consider the diagram to be centred on the origin (0, 0), and the point where all four figures meet in the (+, +) quadrant is (x, y), then the rectangle has dimensions (2x, 2y) and the diagonal of the square is 2z where z = x + y.
And if the ellipse has semi-major axis a and semi-minor axis b, then the equation of the tangent at the point (p, q) is:
and this is the same as the line that defines the side of the square tube:
Hence:
Assuming exactly one of the required widths is a perfect square gives a unique answer to the puzzle.
This Python program runs in 134ms. (Internal runtime is 76ms).
Run: [ @replit ]
Solution: The widths are (in mm): 180, 300, 320, 400, 500.
Swapping [[
icount_exactly()
]] for [[icount_at_least()
]] reveals 4 further solutions, so it is necessary to assume exactly one of the widths is a perfect square.LikeLike
Jim Randell 6:09 pm on 16 December 2022 Permalink |
Or we can use the [[
pythagorean_triples()
]] function from the enigma.py library to get a more efficient program.This Python program runs in 58ms. (Internal runtime is 777µs).
Run: [ @replit ]
LikeLike
GeoffR 4:51 pm on 17 December 2022 Permalink |
LikeLike