The Hidato Number Maze

Image by Onur Kurt from Unsplash

Hidato (also known as Hidoku) is a popular logic puzzle invented by Israeli mathematician Dr. Gyora Benedek. At first glance, it might remind you of Sudoku or a number maze, but its core dynamic relies on constructing a continuous path through a grid.

The challenge is to fill a $9 \times 9$ board with consecutive numbers from 1 to 81 such that each number is an immediate neighbor of the next—horizontally, vertically, or diagonally.

Given a board of dimensions $R \times C$ (in our case $9 \times 9$, with $N=F \cdot C=81$ cells) where some cells already contain fixed initial values, we must determine the placement of the remaining numbers while satisfying the following rules:

  1. Number range: Each cell must contain a unique integer belonging to the set ${1, 2, \dots, N}$.
  2. 8-neighbor connectivity: Two consecutive numbers $k$ and $k+1$ must be placed in adjacent cells horizontally, vertically, or diagonally (Chebyshev distance equal to 1).
  3. Initial clues: Pre-filled numbers on the starting board must strictly remain in their original positions.
  4. Uniqueness: Each cell contains exactly one number, and each number appears on the board exactly once.

The key question we need to answer is: Is there a valid assignment of positions for the entire sequence from 1 to 81, and how can we find it automatically?

Consider the following example:

Do you dare to solve it logically before taking on the model?


This logic game can be formulated elegantly and systematically as a Binary Linear Optimization problem. Care to give it a try?


Want to keep exploring the world of Operations Research? Discover more posts on this topic here.




If you found this useful, please cite this as:

Martín-Campo, F. Javier (Jun 2026). The Hidato Number Maze. https://www.fjmartincampo.com/blog/2026/hidato/.

or as a BibTeX entry:

@misc{martín-campo2026the-hidato-number-maze,
  title   = {The Hidato Number Maze},
  author  = {Martín-Campo, F. Javier},
  year    = {2026},
  month   = {Jun},
  url     = {https://www.fjmartincampo.com/blog/2026/hidato/}
}



Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • A crime has been committed... in a sudoku!
  • The harmony of digits in solving Kakuro
  • Killer Sudoku, the empty board challenge that math can solve
  • Solving the Number Sums board using mathematical optimization
  • Building bridges with linear optimization, the Hashi puzzle