UK Markets close in 3 hrs 12 mins
  • FTSE 100

    7,122.32
    -6.89 (-0.10%)
     
  • FTSE 250

    22,646.08
    -38.76 (-0.17%)
     
  • AIM

    1,182.30
    -6.44 (-0.54%)
     
  • GBP/EUR

    1.1690
    -0.0076 (-0.65%)
     
  • GBP/USD

    1.3235
    -0.0067 (-0.5029%)
     
  • BTC-GBP

    36,677.75
    -703.96 (-1.88%)
     
  • CMC Crypto 200

    1,367.14
    -74.62 (-5.18%)
     
  • S&P 500

    4,538.43
    -38.67 (-0.84%)
     
  • DOW

    34,580.08
    -59.71 (-0.17%)
     
  • CRUDE OIL

    66.22
    -0.28 (-0.42%)
     
  • GOLD FUTURES

    1,782.10
    +21.40 (+1.22%)
     
  • NIKKEI 225

    28,029.57
    +276.20 (+1.00%)
     
  • HANG SENG

    23,766.69
    -22.24 (-0.09%)
     
  • DAX

    15,169.98
    -93.13 (-0.61%)
     
  • CAC 40

    6,765.52
    -30.23 (-0.44%)
     

Can you solve it? Hamiltonian ingenuity on the grid

·1-min read
<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.

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.

Our goal is to create a safe and engaging place for users to connect over interests and passions. In order to improve our community experience, we are temporarily suspending article commenting