**From New Scientist #1605, 24th March 1988** [link]

Oölith the Rational, on conquering the town of Major-Minor, the two parts of which are separated by a river, decreed that two piazzas be built, one (the larger of the two) in Major and one in Minor. They were to be stepped rectangles (see diagram) of square slabs, each measuring 1 groddly by 1 groddly. Each piazza was to contain a number of slabs equal to the perimeter in groddlies multiplied by the king’s age (an exact number of years).

The vizier explained to the grand mason appointed to this task: “A stepped rectangle is a plane array of square slabs laid edge to edge with no overlap. The sides of the figure are zig-zag: if you imagine walking around its perimeter clockwise, you must turn alternately left and right except at the four extreme corners, at each of which you must make exactly two consecutive right turns.”

The mason knew the king’s age (he was in his twenties) and realised that exactly and only two different stepped rectangles were possible which would fit the conditions.

How many slabs did he require to build:

(a) the Major piazza;

(b) the Minor piazza?

[enigma454]

### Like this:

Like Loading...

A bit of analysis gives us an easy way to look for possible dimensions of stepped rectangles, for a given value of the King’s age.

If we measure a “stepped rectangle” by the number of points touching the enclosing rectangle (so the diagram in the puzzle shows a 3×4 rectangle), then the perimeter of an

m × nstepped rectangle is:and the number of slabs required is:

So, if the age of the king is

k, we want:The numerator is always non-negative (

m > 0), so to get a reasonable value fornwe require the denominator to be positive:This Python program runs in 70ms.

Run:[ @repl.it ]Solution:(a) The Major piazza requires 641,520 slabs. (b) The Minor piazza requires 23,328 slabs.The King is 27. The perimeter of the Major piazza is 23,760, and the perimeter of the Minor piazza is 864.

The Minor piazza is very close to square being a 108×109 rectangle, but the Major piazza is over 100 times longer in one dimension than the other, it is a 55×5886 rectangle.

Here is a scale diagram of the two piazzas, next to each other:

It seems that, for any age k, the squarest piazza measures 4k by (4k + 1).

The most unsquare has shorter side 2k + 1.

Only k = 27 (among the twenties) has no solutions in between.

OEIS A045753 [ https://oeis.org/A045753 ] gives a list of possible values

kfor the age of the king that will give only two possible rectangles, with dimensions(m, n)=(4k, 4k + 1)and(m, n)=(2k + 1, 2k(4k + 1)).So we can use the following program:

@Brian: That’s a neat analysis.

I think we can simplify the code a little. As

(4k)² – 1is odd, then any factorisation will also be odd, so the calculation ofmandnwill not have a remainder, and each factorisation will lead to a valid rectangle.Here’s a combination of our two programs: