Teaser 3334: All square
From The Sunday Times, 16th August 2026 [link] [link]
The diagram shows a grid of three rows and five columns of identical small squares. Within that grid one can also spot some larger squares giving a grand total of 26 squares (namely fifteen 1×1 squares, eight 2×2 and three 3×3).
Now I have drawn a larger such grid (with fewer than 50 columns and even fewer rows). Within this new grid there is a grand total of exactly 10,000 squares.
How many rows and how many columns does this new grid have?
[teaser3334]





Jim Randell 7:13 am on 16 August 2026 Permalink |
Here is a straighforward constructive solution, that just counts the number of squares in each candidate grid.
The following Python program runs in 71ms. (Internal runtime is 1ms).
from enigma import (irange, printf) # calculate the number of squares on an <a> by <b> grid def nsquares(a, b): t = 0 for k in irange(min(a, b)): t += (a - k) * (b - k) return t # check the given arrangement assert (nsquares(3, 5) == 26) # target number of squares T = 10000 # consider number of cols for nc in irange(1, 49): # and number of rows for nr in irange(1, nc - 1): t = nsquares(nr, nc) if t < T: continue if t > T: break # output solution printf("rows = {nr}, cols = {nc} -> nsquares = {t}")Solution: [To Be Revealed]
LikeLike
Jim Randell 7:38 am on 16 August 2026 Permalink |
See also: Teaser 1995, Enigma 1086.
Analytically, we can show that for a grid with a rows and b columns (where a ≤ b), then the number of squares in the grid is:
So we can look for solutions to the equation:
The following Python program looks for divisors of 60000 that are consecutive integers, to give a, and then calculates the corresponding b.
This has an internal runtime of just 58µs.
from enigma import (divisor, tuples, div, printf) # look for consecutive divisors of 60,000 S = 60000 for (a, a1) in tuples(divisor(S)): if a1 > 49: break if a1 - a != 1: continue b = div(a - 1 + S // (a * a1), 3) if b is None or b > 49: continue # output solution printf("rows = {a}, cols = {b}")LikeLike
Ruud 7:46 am on 16 August 2026 Permalink |
Brute force:
for ncols in range(1, 50): for nrows in range(1, ncols): if sum((nrows - size + 1) * (ncols - size + 1) for size in range(1, nrows + 1)) == 10000: print(f'{nrows=} {ncols=}')LikeLike