Teaser 2793: Sum triangles
From The Sunday Times, 3rd April 2016 [link] [link]
In this picture:
there are ten upwardly-pointing triangles of all sizes.
In a similar picture with many more rows, the total number of upward-pointing triangles is divisible by all the digits from 1 to 9.
In this larger picture the number of upward-pointing triangles in the bottom row is equal to Trix’s age.
How old is Trix?
[teaser2793]

Jim Randell 8:38 am on 3 June 2021 Permalink |
(See also: Enigma 1296).
The number of upward pointing triangles on a triangular grid of size n is the sum of the triangular numbers from 1 to n. These are the tetrahedral (or triangular pyramidal) numbers (see: OEIS A000292).
The following Python program runs in 50ms.
Run: [ @replit ]
from enigma import (irange, inf, tri, mlcm, call, printf) # generate increasing (grid size, upward triangles) pairs def generate(m=inf): t = 0 for n in irange(1, m): t += tri(n) yield (n, t) # find a solution divisible by d d = call(mlcm, irange(1, 9)) for (n, t) in generate(): if t % d == 0: printf("n={n} t={t}") break # we only need the first solutionSolution: Trix is 54.
Using the formula:
We are looking for solutions where ups(n) is a multiple of 2520:
Which gives the following program:
from enigma import (irange, inf, tuples, multiply, printf) for ns in tuples(irange(1, inf), 3): t = multiply(ns) if t % 15120 == 0: printf("n={n} t={t}", n=ns[0]) breakLikeLike