Advertisement
Canada markets closed
  • S&P/TSX

    22,011.72
    +139.76 (+0.64%)
     
  • S&P 500

    5,070.55
    +59.95 (+1.20%)
     
  • DOW

    38,503.69
    +263.71 (+0.69%)
     
  • CAD/USD

    0.7320
    +0.0019 (+0.26%)
     
  • CRUDE OIL

    83.40
    +0.04 (+0.05%)
     
  • Bitcoin CAD

    90,617.52
    -406.96 (-0.45%)
     
  • CMC Crypto 200

    1,426.91
    +12.15 (+0.86%)
     
  • GOLD FUTURES

    2,335.70
    -6.40 (-0.27%)
     
  • RUSSELL 2000

    2,002.64
    +35.17 (+1.79%)
     
  • 10-Yr Bond

    4.5980
    -0.0250 (-0.54%)
     
  • NASDAQ futures

    17,656.50
    +306.50 (+1.77%)
     
  • VOLATILITY

    15.69
    -1.25 (-7.38%)
     
  • FTSE

    8,044.81
    +20.94 (+0.26%)
     
  • NIKKEI 225

    37,552.16
    +113.55 (+0.30%)
     
  • CAD/EUR

    0.6836
    -0.0014 (-0.20%)
     

Did you solve it? Hamiltonian ingenuity on the grid

Earlier today I set you two puzzles based on Hamiltonian paths in a square grid. A Hamiltonian path is one which visits every cell exactly once. (If you want a print out of the puzzles, click here.)

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

Solution

Thhe numbers 2 and 3 are the only consecutive prime numbers, so they must make up two of the three adjacent shaded cells in the bottom right of the grid. By trying the different permutations it should become clear the only possible way they can be arranged is for the 1 to be in the bottom right square. The keep on going. There are four solutions; they all start and end on the same cell.

ADVERTISEMENT

If a Hamiltonian path joins up to make a loop, it is called a Hamiltonian circuit.

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 the ones mentioned in the previous puzzle plus 53, 59, and 61.

Solution

I hope you enjoyed the puzzles. I’ll be back in two weeks.

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.