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:
(See: OEIS A082652).
So we can look for solutions to the equation:
The following Python program implements a generic solver to find candidate grid dimensions given the total number of squares required. And then solves this particular puzzle by looking for grids that give exactly 10000 squares, and selecting those that meet the remaining requirements of the puzzle.
It has an internal runtime of just 76µs.
from enigma import (divisor, tuples, printf) # find (a, b) grids with a total of <t> squares def solve(t): n = 6 * t # look for consecutive divisors of 6t for (a, a1) in tuples(divisor(n)): if a1 - a != 1: continue (b, r) = divmod(a - 1 + n // (a * a1), 3) if b < a: break if r == 0: yield (a, b) # solve the puzzle for (a, b) in solve(10000): if a < b < 50: printf("rows = {a}, cols = {b}")LikeLike
Frits 11:00 pm on 16 August 2026 Permalink |
@Jim, it doesn’t seem to happen but a check for b > a wouldn’t hurt.
LikeLike
Jim Randell 7:41 am on 17 August 2026 Permalink |
@Frits: Good point. I’ve added in a check for that.
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