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?

Brian Gladman permalink123456789101112131415161718192021222324252627282930# balls in four S layer square base pyramids: 4.S.(S + 1).(2.S + 1) / 6# balls in one T layer triangular base pyramid: T.(T + 1).(T + 2) / 6## The difference of ball numbers in the two constructions:## == [4.S.(S + 1).(2.S + 1)  T.(T + 1).(T + 2))] / 6# == (2.S  T).(4.S^2 + 6.S + T^2 + 3.T + 2.S.T) / 6## Hence the two constructions have equal numbers of balls when T = 2.S## with ball radius r:## Area of square base = 4.(2.r.S)^2 = 16.(r.S)^2# Area of triangle base = {sqrt(3)/4}.{2.r.(T  1 + sqrt(3))}^2sqrt3, s = 3 ** (1 / 2), 0while True:s += 1# the number of ballsnb = 4 * s * (s + 1) * (2 * s + 1) // 6# the areas of the square and triangular bases (in units of ball radii squared)bs, bt = 16 * s * s, sqrt3 * (2 * s  1 + sqrt3) ** 2# find the minimum number of balls for a more than 55% base area reductionif bt < 0.45 * bs:print(f"{nb} balls (4 x {s} layer squares, 1 x {2 * s} layer triangular).")break

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.")