Sunday Times Teaser 2999 – Triangular Card Tower
by Howard Williams
Published Sunday March 15 2020 (link)
Robbie leans two very thin playing cards together, then another two together, placing an identical card across the top forming a platform, and proceeding sideways and upwards to build a roughly triangular tower.
For the bottom layers, he uses a whole number of 53-card packs of large cards (integer length above 70mm), the number of packs equalling the number of bottom layers. He then uses small cards (75% size) to complete the tower, which is 1428mm high. The distance between the bases of two leaning cards is always 0.56 of the length of each card.
Robbie would like to extend the tower sideways and upwards to the next possible integer height, still using large cards only for the bottom layers.
How many extra cards would be needed in total?
-
Brian Gladman permalink12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849from itertools import count# With a card length of c, the heights of the layers of large# and small cards are (96/100).c and (72/100).c respectively;# the widths of the pillars are (56/100).c and (42/100).c# The N'th layer has (3.N - 1) cards in it so the total# number of cards in N layers is N.(3.N + 1) / 2rsum = lambda n: n * (3 * n + 1) // 2# the number of 53 card packsfor packs in count(1):# the number of large cardscards = 53 * packs# the number of layers of the full triangle not completed# when the large cards run outfor m in count(1):# the total number of layers - the number of layers of# large cards is equal to the number of packs of cardsn = m + packs# the large card totals needed to make m and n layersmc, nc = rsum(m), rsum(n)# hence the number of cards cards in the bottom layersbc = nc - mcif bc > cards:break# the bottom layers use all the large cardsif bc == cards:# calculate the integer card length (c) > 70mm from# [(96/100).(n - m) + (72/100).m].c = 1428c, r = divmod(5950, 4 * n - m)if not r and c > 70:print(f"{bc} {c}mm and {mc} {0.75 * c}mm cards ==>"f" m = {m}, n = {n} ==>")# find how many small cards give an integer height in millimetresi, r = 0, 1while r:i += 1xh, r = divmod(72 * i * c, 100)# calculate the extra cards needed in the top and bottom layerstx = rsum(m + i) - mcbx = rsum(n + i) - rsum(m + i) - bcprint(f"{tx + bx} cards ({bx} large, {tx} small, {xh}mm added height).\n")exit()