Sunday Times Teaser 3150 – Pyramids of Wimbledon
by Mark Valentine
Published Sunday February 05 2023 (link)
Edward, the sports shop owner, had an annual display of tennis balls. He arranged the balls in four identical pyramids, with a square base holding each in place (one ball on the top of each pyramid, four on the layer below, nine below that and so on).
However, this year he wanted to display the same number of balls but reduce the total footprint of the bases by at least 55 per cent, to allow for other stock. His son Fred suggested arranging all the balls in one large pyramid with an equilateral triangular base (one ball on the top, three on the layer below, six below that and so on). Edward realised that this would work, but if there were any fewer balls, it wouldn’t work.
How many balls did Edward display?

GeoffR permalink12345678910111213141516171819202122sqrt3 = 3 ** (1/2)BL = [] # list of balls as potential answersfor s in range(3, 50): # square pyramidfor t in range(s, 50): # triangular pyramid# using Brian's derived condition for layer ratiosif t == 2 * s:balls_s = 4 * (s * (s + 1) * (2 * s + 1)) // 6balls_t = (t * (t + 1) * (t + 2)) // 6# working in r^2 units (omitted from As and At below)As = 16 * s**2At = sqrt3 * (t  1 + sqrt3) ** 2# find the minimum number of balls# ..for a more than 55% base area reductionif 100 * At < 45 * As:BL.append(balls_s)# show minimum number of balls for displayprint(f"Edward displayed {min(BL)} balls.")