login
Lexicographically earliest solution of any 9 X 9 sudoku, read by rows.
6

%I #9 Nov 10 2021 10:19:26

%S 1,2,3,4,5,6,7,8,9,4,5,6,7,8,9,1,2,3,7,8,9,1,2,3,4,5,6,2,1,4,3,6,5,8,

%T 9,7,3,6,5,8,9,7,2,1,4,8,9,7,2,1,4,3,6,5,5,3,1,6,4,2,9,7,8,6,4,2,9,7,

%U 8,5,3,1,9,7,8,5,3,1,6,4,2

%N Lexicographically earliest solution of any 9 X 9 sudoku, read by rows.

%C See A107739 for definition of a sudoku.

%e 1,2,3|4,5,6|7,8,9,

%e 4,5,6|7,8,9|1,2,3,

%e 7,8,9|1,2,3|4,5,6,

%e -----------------

%e 2,1,4|3,6,5|8,9,7,

%e 3,6,5|8,9,7|2,1,4,

%e 8,9,7|2,1,4|3,6,5,

%e -----------------

%e 5,3,1|6,4,2|9,7,8,

%e 6,4,2|9,7,8|5,3,1,

%e 9,7,8|5,3,1|6,4,2

%o (PARI) A114288(m=3,n=3)={my(A=Mat([1..m*n]),L); for(i=2,m*n, A=matconcat([A; vector(#A, j, if(i%m!=1, A[i-1,(j-1+n)%#A+1], j>1||L=A[1,]; L=setminus(L, [j=setminus(L,Set(A[,j]))[1+(i==n+1&&j==m*n-1)]]); j))])); A} \\ Also allows to produce minimal sudokus of other sizes, e.g., 2x3 or 3x2. - _M. F. Hasler_, Nov 09 2021

%Y Cf. A107739, A109741.

%K fini,full,nonn,tabf

%O 1,2

%A _Zak Seidov_, Nov 21 2005; corrected Nov 23 2005