### Random Post

### Recent Posts

- Enigma 1105: Road ants
- Enigma 406: The ritual
- Puzzle 69: Division: letters for digits
- Enigma 1106: Not a square unused
- Enigma 405: Uncle bungles the answer
- Enigma 401: Uncle bungles the answer
- Puzzle 70: Football five teams: new method
- Enigma 1107: Factory work
- Enigma 404: Regular timepiece
- Tantalizer 477: Precognition

### Recent Comments

Hugh Casement on Enigma 1105: Road ants | |

Jim Randell on Enigma 1105: Road ants | |

geoffrounce on Enigma 35: Digits all wro… | |

hakank on Puzzle 70: Football five teams… | |

saracogluahmet on Enigma 1740: Sudoprime |

### Archives

### Categories

- article (11)
- enigma (1,089)
- misc (2)
- project euler (2)
- puzzle (23)
- site news (42)
- tantalizer (23)
- teaser (3)

### Site Stats

- 159,510 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.