Teaser 2807: Pentagons
From The Sunday Times, 10th July 2016 [link] [link]
I have taken five identical straight rods and joined each to the next by a hinge to make a flexible ring. With this ring I can make lots of different pentagonal shapes, and in particular I can make lots of pentagons with area equal to a whole number of square centimetres. The largest whole-numbered area achievable is a two-figure number, and the smallest whole-numbered area achievable is another two-figure number. In fact these two numbers use the same two digits but in the reverse order.
What is the largest whole-numbered area achievable?
[teaser2807]
Jim Randell 9:21 am on 3 August 2021 Permalink |
The maximal area is achieved with a cyclic pentagon. If the sides have length x the area is given by:
If this value is not an integer, the maximum integer-valued area will be achieved by a slight deformation of the pentagon to give the floor of this value.
I believe the minimal area is achieved with a degenerate pentagon where two of the sides are collapsed to give an equilateral triangle with a protruding spike.
Again, if this value is not an integer, the minimum integer-valued area will be achieved by opening up the collapsed spike slightly (to give an actual pentagon), and increase the area to the ceiling of this value.
This Python program considers possible Amax and Amin values (each 2 digits, one the reverse of the other), and calculates the range of x values that would give these values. If there are any common values then we have a viable solution. It runs in 50ms.
Run: [ @replit ]
from enigma import (irange, nreverse, sqrt, fdiv, printf) # area multipliers maxA = fdiv(sqrt(5 * (5 + 2 * sqrt(5))), 4) minA = fdiv(sqrt(3), 4) # consider 2 digit maximal area for M in irange(10, 99): m = nreverse(M) if not (9 < m < M): continue # calculate range of x values based on M xmin1 = sqrt(M, maxA) xmax1 = sqrt(M + 1, maxA) # calculate range of x value based on m xmin2 = sqrt(m - 1, minA) xmax2 = sqrt(m, minA) # intersect the intervals xmin = max(xmin1, xmin2) xmax = min(xmax1, xmax2) if not (xmin < xmax): continue printf("Amax={M} Amin={m} -> x = [{xmin}, {xmax}]")Solution: The largest whole-number area achievable is 61 cm².
And the smallest whole-number area achievable is 16 cm².
The length of the rods is between 5.995 cm and 6.003 cm, so (although not mentioned in the puzzle) an integer length (of 6 cm) for the rods could be intended.
For 6 cm rods we have:
LikeLike
Frits 5:03 pm on 4 August 2021 Permalink |
Using Jim’s code as a base but avoiding square root calculations.
The internal run time is 400 nanoseconds (with PyPy).
# "x^2" related multipliers bigMult = 4 / (5 * (5 + 2 * 5**.5))**.5 smallMult = 4 / 3**.5 # consider 2 digit maximal area for t in range(2, 10): for u in range(1, t): M = 10 * t + u m = u * 10 + t # calculate range of x^2 values x2max1 = (M + 1) * bigMult x2min2 = (m - 1) * smallMult # leave inner loop if already a max is smaller than a min # as x2min2 grows faster than x2max1 for subsequent entries if x2max1 < x2min2: break x2min1 = x2max1 - bigMult x2max2 = x2min2 + smallMult # intersect the intervals x2min = max(x2min1, x2min2) x2max = min(x2max1, x2max2) if not(x2min < x2max): continue print(f"answer: {M} cm2")LikeLike