Sudoku solutions...: Clarification
hv at crypt.org
hv at crypt.org
Wed Nov 23 14:37:03 CET 2005
zak seidov <zakseidov at yahoo.com> wrote:
:
:Dear seqfans,
:let me be more clear:
:
:any sudoku solution may be transformed such that
:the numbers in first row, block and column
:are as below:
I don't believe this is true.
:> 1 2 3 | 4 5 6 | 7 8 9
:> 4 5 6 | ? ? ? | ? ? ?
:> 7 8 9 | ? ? ? | ? ? ?
:> ------+-------+----
:> 2 ? ? | ? ? ? | ? ? ?
:> 3 ? ? | ? ? ? | ? ? ?
:> 5 ? ? | ? ? ? | ? ? ?
:> ------+-------+------
:> 6 ? ? | ? ? ? | ? ? ?
:> 8 ? ? | ? ? ? | ? ? ?
:> 9 ? ? | ? ? ? | ? ? ?
:
:To do it,
:first we simply "rename" numbers such that
:first block looks like this:
:1 2 3 |
:4 5 6 |
:7 8 9 |
:------+
:then we rearrange the 4-9 columns such that
:first row looks like this:
:1 2 3 | 4 5 6 | 7 8 9
If at this point the top looks like:
1 2 3 | 4 5 7 | 6 8 9
4 5 6 | ? ? ? | ? ? ?
7 8 9 | ? ? ? | ? ? ?
------+-------+------
.. it seems to me your suggested rearrangement is not possible.
While it is safe to swap two rows or columns within a block, or a row
or column of blocks with another, you cannot swap a row or column
from one block to another.
The best simple approach I know to find a lexically early equivalent is:
- rename the numbers so that top row is 1-2-3-4-5-6-7-8-9
- reorder rows 2-3, 4-6 and 7-9 so that the first digits ascend
- swap block of rows 4-6 with 7-9 if needed.
However it may be possible to get lexically earlier results by
doing some reordering of rows, columns or blocks before renumbering
the top line; I don't know how to go about guaranteeing a canonical
lexically earliest result without trying all the possibilities.
Hugo van der Sanden
More information about the SeqFan
mailing list