Advertisement
UK markets open in 48 minutes
  • NIKKEI 225

    37,117.34
    -962.36 (-2.53%)
     
  • HANG SENG

    16,136.11
    -249.76 (-1.52%)
     
  • CRUDE OIL

    84.39
    +1.66 (+2.01%)
     
  • GOLD FUTURES

    2,393.80
    -4.20 (-0.18%)
     
  • DOW

    37,775.38
    +22.07 (+0.06%)
     
  • Bitcoin GBP

    49,930.64
    +661.78 (+1.34%)
     
  • CMC Crypto 200

    1,283.18
    -29.45 (-2.24%)
     
  • NASDAQ Composite

    15,601.50
    -81.87 (-0.52%)
     
  • UK FTSE All Share

    4,290.02
    +17.00 (+0.40%)
     

Can you solve it? Hamiltonian ingenuity on the grid

<span>Photograph: Yuri Kochetkov - Pool/Getty Images</span>
Photograph: Yuri Kochetkov - Pool/Getty Images

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.

ADVERTISEMENT

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

Meanwhile, please discuss your favourite Hamiltons.

Thanks to Nick Berry of DataGenetics for the first puzzle and Bernardo Recamán, author of The Bogotá Puzzles, for the second.

I set a puzzle here every two weeks on a Monday. I’m always on the look-out for great puzzles. If you would like to suggest one, email me. I also give school talks about maths and puzzles (restrictions allowing). If your school is interested please get in touch.

I’m the author of several books of popular science, most recently The Language Lover’s Puzzle Book, just out in paperback.