Wednesday, December 1, 2021
Science

# Can you solve it? Hamiltonian ingenuity on the grid

No, not that Hamilton. I meant William Rowan Hamilton, the nineteenth century Irish mathematician.

And not that sort of grid. I meant a square grid, like a chessboard or a Sudoku.

Today’s two puzzles do, however, require you to complete a thrilling journey of daredevil zigs and zags. Hold onto your hats! (Click here for a printable page of the puzzles.)

1. The Hamiltonian path

Place the numbers from 1 to 49 on the grid below such that all consecutive numbers are either horizontal or vertical neighbours. In other words, 1 is horizontally or vertically adjacent to 2, which is horizontally or vertically adjacent to 3, and so on up to 49.

The shaded squares are the prime numbers: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 and 47

The solution to the puzzle is what’s known as a Hamiltonian path through the grid, which is a path that passes through every cell exactly once. There are 49 cells and 49 numbers to be placed.

The clue to solving this puzzle is to consider the gaps between the prime numbers (which are those numbers only divisible by themselves and 1). There are four solutions, but they all start and finish on the same cells.

If a Hamiltonian path joins up to make a loop, it is called a Hamiltonian circuit, which is an even better motor racing pun.

2. The Hamiltonian circuit

Place the numbers from 1 to 64 on the grid below such that all consecutive numbers are either horizontal or vertical neighbours, and 1 also is either a horizontal or vertical neighbour of 64. As above, the shaded squares are prime numbers, which are the ones mentioned in the previous puzzle plus 53, 59, and 61.

I’ll be back at 5pm UK with the solutions and some hints. PLEASE NO SPOILERS