Sunday Times Teaser 3151 – Plant Stock
by Howard Williams
Published Sunday February 12 2023 (link)
A garden centre bought 500 plants of four different varieties from its supplier. The price per plant of each variety was a whole number of pence and their total average price worked out at exactly one pound.
The number of plants of variety 2 purchased was “d” greater than that of variety 1, and its price per plant was “d” pence less than that of variety 1. Similarly, the number of variety 3 plants equalled the number of variety 2 plus “d” and its price equalled the variety 2 price less “d” pence. Finally, the number of variety 4 plants equalled the number of variety 3 plus “d” and its price equalled the variety 3 price less “d” pence.
What, in pence, is the most that a plant could have cost?
-
Brian Gladman permalink1234567891011121314151617181920# numbers: n, n + d, n + 2.d, n + 3.d# prices: p, p - d, p - 2.d, p - 3.d## total number = 4.n + 6.d = 500# total cost = 4.n.p - 6.n.d + 6.p.d - 14.d^2 = 50000## n = (250 - 3.d) / 2# p = [(d + 75)^2 + 4375] / 100## p_max is at d_max and hence n_min:# range of <d> to ensure <n> is a positive integerfor d in range(82, 0, -2):n = (250 - 3 * d) // 2p, r = divmod((d + 75) ** 2 + 4375, 100)if not r:print(f"Maximum Possible Variety Price = £{p / 100:.2f} ({d = }, {n = }).")break