Sudoku: Difference between revisions
Content deleted Content added
m →{{header|Perl 6}}: changing output format |
Mathematica |
||
Line 3,011:
}
}</lang>
=={{header|Mathematica}}==
<lang mathematica>solve[array_] :=
NestWhile[
Join @@ Function[newarray,
Function[{i, j},
Table[ReplacePart[newarray,
Position[newarray, 0, {2}, 1][[1]] -> n], {n,
Select[Range@9,
FreeQ[newarray[[i]], #] && FreeQ[newarray[[All, j]], #] &&
FreeQ[Partition[
newarray, {3, 3}][[Sequence @@
Quotient[{i, j}, 3, -2]]], #] &]}]] @@
Position[newarray, 0, {2}, 1][[1]]] /@ # &, {array}, !
FreeQ[#, 0] &]</lang>
=={{header|MATLAB}}==
|