### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,149)
- misc (2)
- project euler (2)
- puzzle (38)
- site news (44)
- tantalizer (40)
- teaser (3)

### Site Stats

- 175,242 hits

Advertisements

Programming Enigma Puzzles

13 April 2015

Posted by on **From New Scientist #2397, 31st May 2003** [link]

George created a novel jigsaw by dissecting a wooden rectangle into 13 square pieces. The pieces had sides which were all different whole numbers of centimetres, and two had sides which are consecutive integers. They fit together in the arrangement shown, but you should not assume that the pieces are drawn to scale.

George’s mother found the squares lying around, and arranged them all together neatly to form a rectangle, with the same dimensions as George’s, but not in his arrangement. All seven of George’s edge pieces were also edge pieces in his mother’s jigsaw, but her layout had one more edge piece.

What were the dimensions of that piece?

[enigma1241]

Advertisements

%d bloggers like this:

I used a variety of tools to solve this puzzle.

Firstly I labelled the 13 squares in the diagram from (apparently) smallest to (apparently) largest,

a, b, c, d, e, f, g, h, i, j, k, l, m.Then by considering vertical slices through the diagram we get 7 equations linking subsets of these variables to the height of the rectangle,

x:By considering horizontal slices through the diagram we get 6 equations linking subsets of these variables to the width of the rectangle,

y:These, along with the area constraint:

Give us 14 equations in 15 variables, so we can rewrite the system to give us the values in the term of a single variable.

I used the SymPy symbolic maths library to do this:

This runs in 3.9s and gives me the following results:

For positive integers

n:We require the values to be all different (which they are), and for two of the values to be consecutive, which means

n=1 (the consecutive values arefandg, having values of 19 and 20 respectively).So we now know that George packed a 3×3, 5×5, 9×9, 11×11, 14×14, 19×19, 20×20, 24×24, 31×31, 33×33, 36×36, 39×39 and a 42×42 square into a 75×112 rectangle. Thus:

The 7 squares in the perimeter of George’s packing are: 19, 24, 31, 33, 36, 39, 42.

George’s Mum also packed the squares into a 75×112 rectangle, but in a (non-trivially) different way

I wrote my own rectangle packer for

Enigma 1251(based on my code forEnigma 17), but here I’ve solved the packing problem with a MiniZinc model:(Note that the orientation constraint could be simplified here, as the rectangles we are packing are squares).

This program runs in 718ms (using:

mzn-g12lazy -a enigma1241.mzn), and produces two separate packings, George’s shown above, and the packing shown below (along with their rotations and reflections).This second packing is the one that George’s Mum made.

The 8 squares in the perimeter of this packing are: 19, 20, 24, 31, 33, 36, 39, 42.

Solution:The extra edge piece in George’s Mum’s packing is the 20×20 square.