SudokuWiki
SudokuWiki.org
Strategies for Popular Number Puzzles

Sudoku Min-Lex

Is it possible to know if two Sudoku puzzles are essentially the same? We know that a puzzle can be rotated, reflected the rows and columns swapped without effecting the puzzle. These are called symmetries. Applying a symmetry can make a puzzle (or filled in board) look very different. I discuss this here. So is there a version of the puzzle we can consider to be the authentic version? Yes there is - and we call that the canonical puzzle. Consider the puzzle in a single line like a definition file. We can read it as a long 81 digit number. The special property of a canonical puzzle is that it is the smallest number. We call this Minimally Lexographic.

Let us take my "tough" example puzzle and view it as a line
3.9...4..2..7.9....87......75..6.23.6..9.4..8.28.5..41......59....1.6..7..6...1.4
369218475215749863487635912754861239631924758928357641173482596542196387896573124
The solution count will give us the solution string. What is new in "Solution Count" is a Min-Lex feature at the bottom of the popup. This generates the canonical version of the puzzle:
123456789457189236698273541261947853745831692839625417384792165512368974976514328
...45.7.9..7.89.3......3.412..9..8..7..8..6.........17.8.....65.12.6...49.6...32.
One of the symmetries of Sudoku us the ability to transpose numbers. Any puzzle or filled board will have a canonical version that starts 123456789 in the first row. The second row would like to start 567 since 123 is already in the box but we can't guarantee the values on the second line. We need need a clever algorithm to mix up the values such that it generates the smallest number. That algorithm is called Min-Lex.

Sudoku enthusiasts started to do his almost as soon as Sudoku became popular. I'd like to thank and credit Mathimagics (Jim White, 2020) for publishing his version of Min-Lex on the New Sudoku Players forum and allowing his code to be reproduced. His code is in turn based on Michael Deverin, 2011, who I also credit and thank.

Solver Biases

If two puzzles are canonically the same they should have identical solve paths and ratings. However your solver and mine may well have some biases that cause a puzzle to go down certain roads in preference to others. For example, X-Cycles looks at one number at a time. Any search for X-Cycles would naturally start at 1 and finish on 9. Perhaps there is a 3-Cycle and a 6-Cycle. Transposing the numbers may produced two canonically identical puzzles but the solver finds the 3-Cycle before the 6-Cycle in one and not the other.

For the most part this won't affect the grade too much. But if you find a canonical puzzle radically different from it's original please let me know.



Comments

Your Name/Handle

Email Address - required for confirmation (it will not be displayed here)

Your Comment

Please enter the
letters you see:
arrow
Enter these letters Remember me


Please ensure your comment is relevant to this article.
Email addresses are never displayed, but they are required to confirm your comments. When you enter your name and email address, you'll be sent a link to confirm your comment. Line breaks and paragraphs are automatically converted - no need to use <p> or <br> tags.
CommentsTalk
Article created on 22-September-2025. Views: 250
This page was last modified on 22-September-2025.
All text is copyright and for personal use only but may be reproduced with the permission of the author.
Copyright Andrew Stuart @ Syndicated Puzzles, Privacy, 2007-2025