Sunday Times Teaser 2968 – Gardening Division
by Danny Roth
Published August 11 2019 (link)
George and Martha’s garden is a perfect square of length (whole number of metres) a twodigit number ab. The area is a threedigit number cde. In the middle, they have planted a square flowerbed of a length which is a singledigit number f and area a twodigit number gh.
They have called in a gardener, who works for a singledigit i hours. He works for a whole number of minutes on the flowerbed and the remainder on the surrounding lawn. Each square metre of the flowerbed requires n (a single digit) times the time spent on each square metre of the surrounding lawn. I have mentioned nine letters, ai inclusive, and each stands for a different positive digit.
How many minutes does the gardener work on the lawn?

Erling Torkildsen permalink12345678910111213141516171819202122232425from itertools import permutationsZ = set('123456789')for a in range(1, 4):for b in range(1, 10):if b == a:continueA, B = str(a), str(b)cde = (10 * a + b) ** 2CDE = str(cde)if A not in CDE and B not in CDE:if len(CDE) == len(set(CDE)) == 3:FGHI = Z.difference(set((CDE + A + B)))for F, G, H, I in permutations(FGHI):f, g, h, i = int(F), int(G), int(H), int(I)if f ** 2 == 10 * g + h:bed, lawn = f ** 2, cde  f ** 2for n in range(2, 10):v = 60 * i / (bed * n + lawn)if bed * n * v == int(bed * n * v):print(f"({cde}  {bed})m2", end="")print(f" * {v} min/m2", end="")print(f" = {int(lawn * v)} min.")