(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 24234, 704] NotebookOptionsPosition[ 22190, 634] NotebookOutlinePosition[ 22652, 652] CellTagsIndexPosition[ 22609, 649] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell["Marcel D\[EAcute]l\[EGrave]ze", "Text"], Cell[CellGroupData[{ Cell["SUDOKU, ensemble des solutions", "Subtitle"], Cell[CellGroupData[{ Cell["Entr\[EAcute]e des donn\[EAcute]es", "Subsection"], Cell["\<\ Grille vierge (\[AGrave] recopier sur la grille \"donnee\" pour entrer une \ nouvelle grille):\ \>", "Text"], Cell[BoxData[ RowBox[{GridBox[{ {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"} }], ";"}]], "Input"], Cell["Grille de donn\[EAcute]es (\[AGrave] remplir):", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"donnee", "=", GridBox[{ {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "9", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "6"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "7", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "1"}, {"\[Placeholder]", "\[Placeholder]", "5", "\[Placeholder]", "2", "8", "3", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "9", "8", "1", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"\[Placeholder]", "7", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "3", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "4", "9", "8", "\[Placeholder]"}, {"\[Placeholder]", "\[Placeholder]", "3", "5", "4", "\[Placeholder]", "6", "\[Placeholder]", "\[Placeholder]"}, {"1", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "3", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"}, {"2", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]", "9", "\[Placeholder]", "\[Placeholder]", "\[Placeholder]"} }]}], ";"}]], "Input"], Cell["\<\ Repr\[EAcute]sentation interne des grilles:\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"donnee", "=", RowBox[{"Apply", "[", RowBox[{"sdk", ",", RowBox[{"donnee", "/.", RowBox[{"{", RowBox[{"\[Placeholder]", "\[Rule]", "Null"}], "}"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"sdk", "[", RowBox[{ RowBox[{"{", RowBox[{ "Null", ",", "Null", ",", "Null", ",", "9", ",", "Null", ",", "Null", ",", "Null", ",", "Null", ",", "6"}], "}"}], ",", RowBox[{"{", RowBox[{ "Null", ",", "Null", ",", "Null", ",", "7", ",", "Null", ",", "Null", ",", "Null", ",", "Null", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ "Null", ",", "Null", ",", "5", ",", "Null", ",", "2", ",", "8", ",", "3", ",", "Null", ",", "Null"}], "}"}], ",", RowBox[{"{", RowBox[{ "Null", ",", "9", ",", "8", ",", "1", ",", "Null", ",", "Null", ",", "Null", ",", "Null", ",", "Null"}], "}"}], ",", RowBox[{"{", RowBox[{ "Null", ",", "7", ",", "Null", ",", "Null", ",", "Null", ",", "Null", ",", "Null", ",", "3", ",", "Null"}], "}"}], ",", RowBox[{"{", RowBox[{ "Null", ",", "Null", ",", "Null", ",", "Null", ",", "Null", ",", "4", ",", "9", ",", "8", ",", "Null"}], "}"}], ",", RowBox[{"{", RowBox[{ "Null", ",", "Null", ",", "3", ",", "5", ",", "4", ",", "Null", ",", "6", ",", "Null", ",", "Null"}], "}"}], ",", RowBox[{"{", RowBox[{ "1", ",", "Null", ",", "Null", ",", "Null", ",", "Null", ",", "3", ",", "Null", ",", "Null", ",", "Null"}], "}"}], ",", RowBox[{"{", RowBox[{ "2", ",", "Null", ",", "Null", ",", "Null", ",", "Null", ",", "9", ",", "Null", ",", "Null", ",", "Null"}], "}"}]}], "]"}]], "Output", CellChangeTimes->{ 3.474378998915967*^9, 3.4743791953707666`*^9, {3.4743792595147667`*^9, 3.474379278034767*^9}, 3.4743795049957666`*^9, 3.474379589544767*^9}] }, Open ]], Cell["Affichage d'une grille:", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"affiche", "[", "grille_sdk", "]"}], ":=", RowBox[{ RowBox[{"FrameBox", "[", RowBox[{"GridBox", "[", RowBox[{ RowBox[{ RowBox[{"Apply", "[", RowBox[{"List", ",", "grille"}], "]"}], "/.", RowBox[{"{", RowBox[{"Null", "\[Rule]", "\"\<\[CenterDot]\>\""}], "}"}]}], ",", RowBox[{"RowLines", "\[Rule]", RowBox[{"{", RowBox[{ "False", ",", "False", ",", "True", ",", "False", ",", "False", ",", "True", ",", "False", ",", "False"}], "}"}]}], ",", RowBox[{"ColumnLines", "\[Rule]", RowBox[{"{", RowBox[{ "False", ",", "False", ",", "True", ",", "False", ",", "False", ",", "True", ",", "False", ",", "False"}], "}"}]}]}], "]"}], "]"}], "//", "DisplayForm"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"affiche", "[", "g_List", "]"}], ":=", RowBox[{"Map", "[", RowBox[{"affiche", ",", "g"}], "]"}]}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"affiche", "[", "donnee", "]"}]], "Input"], Cell[BoxData[ TagBox[ FrameBox[GridBox[{ {"\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "9", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "6"}, {"\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "7", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "1"}, {"\[CenterDot]", "\[CenterDot]", "5", "\[CenterDot]", "2", "8", "3", "\[CenterDot]", "\[CenterDot]"}, {"\[CenterDot]", "9", "8", "1", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]"}, {"\[CenterDot]", "7", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "3", "\[CenterDot]"}, {"\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "4", "9", "8", "\[CenterDot]"}, {"\[CenterDot]", "\[CenterDot]", "3", "5", "4", "\[CenterDot]", "6", "\[CenterDot]", "\[CenterDot]"}, {"1", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "3", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]"}, {"2", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]", "9", "\[CenterDot]", "\[CenterDot]", "\[CenterDot]"} }, GridBoxDividers->{ "Columns" -> { False, False, False, True, False, False, True, False, {False}, False}, "ColumnsIndexed" -> {}, "Rows" -> { False, False, False, True, False, False, True, False, {False}, False}, "RowsIndexed" -> {}}]], DisplayForm]], "Output", CellChangeTimes->{ 3.474378998934967*^9, 3.4743791953957667`*^9, {3.4743792595357666`*^9, 3.4743792780547667`*^9}, 3.474379505017767*^9, 3.4743795895667667`*^9}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["R\[EAcute]solution", "Subsection"], Cell[CellGroupData[{ Cell["\<\ D\[EAcute]termination des chiffres possibles\ \>", "Subsubsection"], Cell["\<\ Extractions de lignes, de colonnes et de carr\[EAcute]s:\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"ligne", "[", RowBox[{"grille_sdk", ",", "i_"}], "]"}], ":=", RowBox[{"grille", "[", RowBox[{"[", "i", "]"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"colonne", "[", RowBox[{"grille_sdk", ",", "j_"}], "]"}], ":=", RowBox[{ RowBox[{"Transpose", "[", RowBox[{"Apply", "[", RowBox[{"List", ",", "grille"}], "]"}], "]"}], "[", RowBox[{"[", "j", "]"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"carre", "[", RowBox[{"grille_sdk", ",", "i_", ",", "j_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"ib", ",", "jb", ",", "ic", ",", "jc"}], "}"}], ",", RowBox[{ RowBox[{"ib", "=", RowBox[{ RowBox[{"3", RowBox[{"Quotient", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "3"}], "]"}]}], "+", "1"}]}], ";", RowBox[{"jb", "=", RowBox[{ RowBox[{"3", RowBox[{"Quotient", "[", RowBox[{ RowBox[{"j", "-", "1"}], ",", "3"}], "]"}]}], "+", "1"}]}], ";", RowBox[{"Flatten", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"grille", "[", RowBox[{"[", RowBox[{ RowBox[{"ib", "+", "ic"}], ",", RowBox[{"jb", "+", "jc"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"ic", ",", "0", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"jc", ",", "0", ",", "2"}], "}"}]}], "]"}], ",", "1"}], "]"}]}]}], "]"}]}]], "Input"], Cell["\<\ Pour une case vide, les chiffres possibles (qu'on pourrait essayer) sont ceux \ qui ne se trouvent ni dans la ligne, ni dans la colonne, ni dans le carr\ \[EAcute]:\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"case", "[", RowBox[{"grille_sdk", ",", "i_", ",", "j_"}], "]"}], ":=", RowBox[{ RowBox[{"grille", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "/;", RowBox[{"IntegerQ", "[", RowBox[{"grille", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "]"}]}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"case", "[", RowBox[{"grille_sdk", ",", "i_", ",", "j_"}], "]"}], ":=", RowBox[{"Complement", "[", RowBox[{ RowBox[{"Range", "[", RowBox[{"1", ",", "9"}], "]"}], ",", RowBox[{"ligne", "[", RowBox[{"grille", ",", "i"}], "]"}], ",", RowBox[{"colonne", "[", RowBox[{"grille", ",", "j"}], "]"}], ",", RowBox[{"carre", "[", RowBox[{"grille", ",", "i", ",", "j"}], "]"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"possible", "[", "grille_sdk", "]"}], ":=", RowBox[{"Apply", "[", RowBox[{"sdk", ",", RowBox[{"Table", "[", RowBox[{ RowBox[{"case", "[", RowBox[{"grille", ",", "i", ",", "j"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "9"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "9"}], "}"}]}], "]"}]}], "]"}]}], ";"}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"affiche", "[", RowBox[{"possible", "[", "donnee", "]"}], "]"}]], "Input", CellChangeTimes->{{3.474379181991767*^9, 3.4743791922127666`*^9}, { 3.4743792468137665`*^9, 3.474379272904767*^9}, {3.4743793389617667`*^9, 3.4743793806937666`*^9}, {3.474379464630767*^9, 3.4743794663107667`*^9}, { 3.474379577334767*^9, 3.4743795839947667`*^9}}], Cell[BoxData[ TagBox[ FrameBox[GridBox[{ { RowBox[{"{", RowBox[{"3", ",", "4", ",", "7", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"1", ",", "2", ",", "3", ",", "4", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"1", ",", "2", ",", "4", ",", "7"}], "}"}], "9", RowBox[{"{", RowBox[{"1", ",", "3", ",", "5"}], "}"}], RowBox[{"{", RowBox[{"1", ",", "5"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "7", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "7"}], "}"}], "6"}, { RowBox[{"{", RowBox[{"3", ",", "4", ",", "6", ",", "8", ",", "9"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "3", ",", "4", ",", "6", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "6", ",", "9"}], "}"}], "7", RowBox[{"{", RowBox[{"3", ",", "5", ",", "6"}], "}"}], RowBox[{"{", RowBox[{"5", ",", "6"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "9"}], "}"}], "1"}, { RowBox[{"{", RowBox[{"4", ",", "6", ",", "7", ",", "9"}], "}"}], RowBox[{"{", RowBox[{"1", ",", "4", ",", "6"}], "}"}], "5", RowBox[{"{", RowBox[{"4", ",", "6"}], "}"}], "2", "8", "3", RowBox[{"{", RowBox[{"4", ",", "7", ",", "9"}], "}"}], RowBox[{"{", RowBox[{"4", ",", "7", ",", "9"}], "}"}]}, { RowBox[{"{", RowBox[{"3", ",", "4", ",", "5", ",", "6"}], "}"}], "9", "8", "1", RowBox[{"{", RowBox[{"3", ",", "5", ",", "6", ",", "7"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "5", ",", "6", ",", "7"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "7"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "6", ",", "7"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "7"}], "}"}]}, { RowBox[{"{", RowBox[{"4", ",", "5", ",", "6"}], "}"}], "7", RowBox[{"{", RowBox[{"1", ",", "2", ",", "4", ",", "6"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "6", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"5", ",", "6", ",", "8", ",", "9"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "5", ",", "6"}], "}"}], RowBox[{"{", RowBox[{"1", ",", "2", ",", "4", ",", "5"}], "}"}], "3", RowBox[{"{", RowBox[{"2", ",", "4", ",", "5"}], "}"}]}, { RowBox[{"{", RowBox[{"3", ",", "5", ",", "6"}], "}"}], RowBox[{"{", RowBox[{"1", ",", "2", ",", "3", ",", "5", ",", "6"}], "}"}], RowBox[{"{", RowBox[{"1", ",", "2", ",", "6"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "3", ",", "6"}], "}"}], RowBox[{"{", RowBox[{"3", ",", "5", ",", "6", ",", "7"}], "}"}], "4", "9", "8", RowBox[{"{", RowBox[{"2", ",", "5", ",", "7"}], "}"}]}, { RowBox[{"{", RowBox[{"7", ",", "8", ",", "9"}], "}"}], RowBox[{"{", "8", "}"}], "3", "5", "4", RowBox[{"{", RowBox[{"1", ",", "2", ",", "7"}], "}"}], "6", RowBox[{"{", RowBox[{"1", ",", "2", ",", "7", ",", "9"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "7", ",", "8", ",", "9"}], "}"}]}, {"1", RowBox[{"{", RowBox[{"4", ",", "5", ",", "6", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"4", ",", "6", ",", "7", ",", "9"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "6", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"6", ",", "7", ",", "8"}], "}"}], "3", RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "7", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "7", ",", "9"}], "}"}], RowBox[{"{", RowBox[{"2", ",", "4", ",", "5", ",", "7", ",", "8", ",", "9"}], "}"}]}, {"2", RowBox[{"{", RowBox[{"4", ",", "5", ",", "6", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"4", ",", "6", ",", "7"}], "}"}], RowBox[{"{", RowBox[{"6", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"1", ",", "6", ",", "7", ",", "8"}], "}"}], "9", RowBox[{"{", RowBox[{"1", ",", "4", ",", "5", ",", "7", ",", "8"}], "}"}], RowBox[{"{", RowBox[{"1", ",", "4", ",", "5", ",", "7"}], "}"}], RowBox[{"{", RowBox[{"3", ",", "4", ",", "5", ",", "7", ",", "8"}], "}"}]} }, GridBoxDividers->{ "Columns" -> { False, False, False, True, False, False, True, False, {False}, False}, "ColumnsIndexed" -> {}, "Rows" -> { False, False, False, True, False, False, True, False, {False}, False}, "RowsIndexed" -> {}}]], DisplayForm]], "Output", CellChangeTimes->{ 3.474378998964967*^9, 3.474379195439767*^9, {3.474379259567767*^9, 3.474379278084767*^9}, {3.4743793445537667`*^9, 3.474379381624767*^9}, 3.474379468840767*^9, 3.474379505050767*^9, {3.474379585368767*^9, 3.4743795896087666`*^9}}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ D\[EAcute]termination des grilles qui comportent un chiffre de plus\ \>", "Subsubsection"], Cell["\<\ Tester les impasses. Former la grille suivante, ou plusieurs grilles lorsqu'il y a plusieurs \ possibilit\[EAcute]s, comme suit: *\tchoisir une case pour laquelle la liste des chiffres \[AGrave] essayer est \ de longueur minimale; *\tpour chaque chiffre \[AGrave] essayer, former une grille comportant ce \ chiffre\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"suivant", "[", "grille_sdk", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "e1", ",", "li", ",", "lj", ",", "nPoss", ",", "i", ",", "j", ",", "k"}], "}"}], ",", RowBox[{ RowBox[{"e1", "=", RowBox[{"possible", "[", "grille", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"MemberQ", "[", RowBox[{"e1", ",", RowBox[{"{", "}"}], ",", RowBox[{"{", "2", "}"}]}], "]"}], ",", RowBox[{"{", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"nPoss", "=", "10"}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"1", "\[LessEqual]", RowBox[{"Length", "[", RowBox[{"e1", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "]"}], "<", "nPoss"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"li", "=", "i"}], ";", RowBox[{"lj", "=", "j"}], ";", RowBox[{"nPoss", "=", RowBox[{"Length", "[", RowBox[{"e1", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "]"}]}]}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"i", ",", "1", ",", "9"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "9"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Table", "[", RowBox[{ RowBox[{"ReplacePart", "[", RowBox[{"grille", ",", RowBox[{ RowBox[{"e1", "[", RowBox[{"[", RowBox[{"li", ",", "lj"}], "]"}], "]"}], "[", RowBox[{"[", "k", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"li", ",", "lj"}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "1", ",", "nPoss"}], "}"}]}], "]"}]}]}], "]"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"suivant", "[", "g_List", "]"}], ":=", RowBox[{"Flatten", "[", RowBox[{"Map", "[", RowBox[{"suivant", ",", "g"}], "]"}], "]"}]}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["It\[EAcute]ration", "Subsubsection"], Cell[BoxData[ RowBox[{ RowBox[{"resous", "[", "grille_", "]"}], ":=", RowBox[{"Nest", "[", RowBox[{"suivant", ",", "donnee", ",", RowBox[{"81", "-", RowBox[{"Count", "[", RowBox[{"donnee", ",", "_Integer", ",", RowBox[{"{", "2", "}"}]}], "]"}]}]}], "]"}]}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"affiche", "[", RowBox[{"resous", "[", "donnee", "]"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"{", TagBox[ FrameBox[GridBox[{ {"8", "3", "7", "9", "1", "5", "4", "2", "6"}, {"9", "4", "2", "7", "3", "6", "8", "5", "1"}, {"6", "1", "5", "4", "2", "8", "3", "7", "9"}, {"3", "9", "8", "1", "5", "7", "2", "6", "4"}, {"4", "7", "6", "8", "9", "2", "1", "3", "5"}, {"5", "2", "1", "3", "6", "4", "9", "8", "7"}, {"7", "8", "3", "5", "4", "1", "6", "9", "2"}, {"1", "6", "9", "2", "7", "3", "5", "4", "8"}, {"2", "5", "4", "6", "8", "9", "7", "1", "3"} }, GridBoxDividers->{ "Columns" -> { False, False, False, True, False, False, True, False, {False}, False}, "ColumnsIndexed" -> {}, "Rows" -> { False, False, False, True, False, False, True, False, {False}, False}, "RowsIndexed" -> {}}]], DisplayForm], "}"}]], "Output", CellChangeTimes->{ 3.474379001861967*^9, 3.4743791983657665`*^9, {3.4743792636227665`*^9, 3.474379281109767*^9}, 3.474379507949767*^9, 3.474379592529767*^9}] }, Open ]] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->{1005, 640}, WindowMargins->{{4, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{Automatic, Automatic}, PrintingOptions->{"PrintingMargins"->{{36, 36}, {72, 36}}}, FrontEndVersion->"6.0 for Microsoft Windows (32-bit) (June 19, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 45, 0, 29, "Text"], Cell[CellGroupData[{ Cell[638, 25, 50, 0, 49, "Subtitle"], Cell[CellGroupData[{ Cell[713, 29, 56, 0, 36, "Subsection"], Cell[772, 31, 118, 3, 29, "Text"], Cell[893, 36, 1675, 29, 148, "Input"], Cell[2571, 67, 62, 0, 29, "Text"], Cell[2636, 69, 1391, 26, 148, "Input"], Cell[4030, 97, 67, 2, 29, "Text"], Cell[CellGroupData[{ Cell[4122, 103, 222, 7, 31, "Input"], Cell[4347, 112, 1658, 41, 107, "Output"] }, Open ]], Cell[6020, 156, 39, 0, 29, "Text"], Cell[6062, 158, 841, 22, 72, "Input"], Cell[6906, 182, 149, 4, 31, "Input"], Cell[CellGroupData[{ Cell[7080, 190, 65, 1, 31, "Input"], Cell[7148, 193, 1683, 32, 160, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[8880, 231, 40, 0, 36, "Subsection"], Cell[CellGroupData[{ Cell[8945, 235, 77, 2, 28, "Subsubsection"], Cell[9025, 239, 80, 2, 29, "Text"], Cell[9108, 243, 173, 5, 31, "Input"], Cell[9284, 250, 275, 8, 31, "Input"], Cell[9562, 260, 1116, 34, 52, "Input"], Cell[10681, 296, 188, 4, 29, "Text"], Cell[10872, 302, 359, 11, 31, "Input"], Cell[11234, 315, 474, 13, 31, "Input"], Cell[11711, 330, 462, 14, 31, "Input"], Cell[CellGroupData[{ Cell[12198, 348, 371, 6, 31, "Input"], Cell[12572, 356, 5184, 139, 160, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[17805, 501, 100, 2, 28, "Subsubsection"], Cell[17908, 505, 338, 8, 83, "Text"], Cell[18249, 515, 2159, 59, 152, "Input"], Cell[20411, 576, 185, 5, 31, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[20633, 586, 42, 0, 28, "Subsubsection"], Cell[20678, 588, 303, 8, 31, "Input"], Cell[CellGroupData[{ Cell[21006, 600, 98, 2, 31, "Input"], Cell[21107, 604, 1031, 24, 160, "Output"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)