### Random Post

### Recent Posts

### Recent Comments

Jim Randell on Enigma 432: Holiday on the… | |

Brian Gladman on Enigma 432: Holiday on the… | |

Jim Randell on Enigma 432: Holiday on the… | |

Brian Gladman on Enigma 432: Holiday on the… | |

Jim Randell on Enigma 432: Holiday on the… |

### Archives

### Categories

- article (11)
- enigma (1,140)
- misc (2)
- project euler (2)
- puzzle (35)
- site news (44)
- tantalizer (37)
- teaser (3)

### Site Stats

- 172,739 hits

The following Python program works by deconstructing the product of n x m in to as few squares as possible, then tries to fit those squares into an n x m grid.

Runtime (using PyPy) is 1.3s for the 18 x 19 case and 56.9s for the 22 x 23 case.

Solution:(a) An 18 x 19 near-square can be filled with 7 squarelets. (b) A 22 x 23 near-square can be filled with 8 squarelets.I don’t have a Python compiler and am too stupid to work out a back-tracking (and/or recursive) method in Basic. Juggling the squares by hand always seems to need more of them — perhaps I’m too impatient as well. Can anyone provide solutions for those 7 and 8 squarelets respectively?

If you want to try Python it is freely available for many platforms (and installed by default on some). I would recommend it if you want to explore programming beyond BASIC. See http://www.python.org for details.

Here are diagrams of the solutions my program finds for the 18×19 and 22×23 squares:

The smallest “near square” that requires 9 squarelets is 19×20.

That’s great: thanks a lot, Jim.

Oh, and I do appreciate your insights, methods, references to sources, and other comments. It was a great weakness of the Enigmas (enigmata?) that usually all we got was a bald solution — often just a single numerical value — and were none the wiser as to how it was derived. My own sledgehammer or ‘British Museum’ approach was not usually very educational. Some puzzles were later explained on the NS web site, but only a small proportion of the total.