| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 |
- (* Content-type: application/vnd.wolfram.mathematica *)
-
- (*** Wolfram Notebook File ***)
- (* http://www.wolfram.com/nb *)
-
- (* CreatedBy='Mathematica 9.0' *)
-
- (*CacheID: 234*)
- (* Internal cache information:
- NotebookFileLineBreakTest
- NotebookFileLineBreakTest
- NotebookDataPosition[ 157, 7]
- NotebookDataLength[ 23592, 526]
- NotebookOptionsPosition[ 23059, 504]
- NotebookOutlinePosition[ 23414, 520]
- CellTagsIndexPosition[ 23371, 517]
- WindowFrame->Normal*)
-
- (* Beginning of Notebook Content *)
- Notebook[{
-
- Cell[CellGroupData[{
- Cell[BoxData[{
- RowBox[{"n", " ", "=", " ", "6"}], "\[IndentingNewLine]",
- RowBox[{"q", " ", "=", " ", "0"}], "\[IndentingNewLine]",
- RowBox[{"row", " ", "=", " ", "1"}], "\[IndentingNewLine]",
- RowBox[{"board", " ", "=", " ",
- RowBox[{"Array", "[",
- RowBox[{
- RowBox[{"0", "&"}], ",",
- RowBox[{"{",
- RowBox[{"n", ",", "n"}], "}"}]}], "]"}]}], "\[IndentingNewLine]",
- StyleBox[
- RowBox[{
- RowBox[{
- RowBox[{"addQueen", "[",
- RowBox[{"x_", ",", " ", "y_"}], "]"}], " ", ":=", "\[IndentingNewLine]",
-
- RowBox[{"If", "[",
- RowBox[{
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "y"}], "]"}], "]"}], " ", "\[Equal]", " ", "0"}],
- ",", " ", "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"For", "[",
- RowBox[{
- RowBox[{"i", "=", "1"}], ",", " ",
- RowBox[{"i", " ", "\[LessEqual]", " ", "n"}], ",", " ",
- RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "i"}], "]"}], "]"}], "++"}], ";",
- "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"i", ",", "y"}], "]"}], "]"}], "++"}], ";"}]}], "]"}],
- ";", "\[IndentingNewLine]", "\t",
- RowBox[{"addDiag1", "[",
- RowBox[{"x", ",", "y"}], "]"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"addDiag2", "[",
- RowBox[{"x", ",", "y"}], "]"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "y"}], "]"}], "]"}], "=", "5"}], ";",
- "\[IndentingNewLine]", "\t",
- RowBox[{"q", "++"}], ";"}]}], "]"}]}], "\[IndentingNewLine]"}],
- FontWeight->"Plain"], "\[IndentingNewLine]",
- StyleBox[
- RowBox[{
- RowBox[{"removeQueen", "[",
- RowBox[{"x_", ",", " ", "y_"}], "]"}], " ", ":=", "\[IndentingNewLine]",
- RowBox[{"If", "[",
- RowBox[{
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "y"}], "]"}], "]"}], " ", "\[Equal]", " ", "0"}],
- ",", " ", "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"For", "[",
- RowBox[{
- RowBox[{"i", "=", "1"}], ",", " ",
- RowBox[{"i", " ", "\[LessEqual]", " ", "n"}], ",", " ",
- RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "i"}], "]"}], "]"}], "--"}], ";",
- "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"i", ",", "y"}], "]"}], "]"}], "--"}], ";"}]}], "]"}],
- ";", "\[IndentingNewLine]", "\t",
- RowBox[{"removeDiag1", "[",
- RowBox[{"x", ",", "y"}], "]"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"removeDiag2", "[",
- RowBox[{"x", ",", "y"}], "]"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "y"}], "]"}], "]"}], "=", "0"}], ";",
- "\[IndentingNewLine]", "\t",
- RowBox[{"q", "--"}], ";"}]}], "]"}]}],
- FontWeight->"Plain"]}], "Input",
- CellChangeTimes->{{3.614086821784018*^9, 3.6140868795392036`*^9}, {
- 3.614086945476557*^9, 3.614086970717807*^9}, {3.61408703324579*^9,
- 3.6140870349245043`*^9}, 3.614087130081169*^9, {3.614087317095318*^9,
- 3.6140873272137947`*^9}, {3.6140886413500223`*^9, 3.614088651038863*^9}, {
- 3.6140902250010433`*^9, 3.6140902332955103`*^9}, 3.614090509191803*^9, {
- 3.614093125135645*^9, 3.614093125270405*^9}, {3.614228606199759*^9,
- 3.614228617023769*^9}, {3.614228931889865*^9, 3.614228932492371*^9}, {
- 3.61427384631563*^9, 3.614273849608101*^9}, 3.6142748615725193`*^9, {
- 3.6142749495022507`*^9, 3.614274950708486*^9}, {3.614274999534811*^9,
- 3.614275001013351*^9}, {3.614295935721984*^9, 3.614295936287813*^9}, {
- 3.6142965206318483`*^9, 3.614296525264701*^9}, {3.614296734051941*^9,
- 3.614296777244946*^9}, {3.614297004580608*^9, 3.614297015943162*^9}, {
- 3.614297077007979*^9, 3.614297117624159*^9}, {3.615003933618802*^9,
- 3.615003952051154*^9}, {3.6151062543706408`*^9, 3.6151062544402933`*^9}, {
- 3.6151074422815313`*^9, 3.6151074474558573`*^9}, {3.615107912312002*^9,
- 3.615107912348734*^9}, {3.6151851034876432`*^9, 3.6151851039492817`*^9}, {
- 3.615190011619216*^9, 3.6151900134082203`*^9}, {3.6151901948792753`*^9,
- 3.6151901966209927`*^9}, {3.615190247737862*^9, 3.615190277447234*^9}, {
- 3.615190332812373*^9, 3.615190337536715*^9}, {3.615190379501601*^9,
- 3.6151903819955*^9}, {3.615190436270568*^9, 3.615190461651951*^9}, {
- 3.615190658485202*^9, 3.6151906613615026`*^9}, {3.6151916388089323`*^9,
- 3.6151916389877367`*^9}, {3.615261478266347*^9, 3.615261480128601*^9}, {
- 3.61526230964149*^9, 3.615262310926528*^9}, 3.615262474556699*^9,
- 3.6152625328141727`*^9, {3.615263156432143*^9, 3.6152631565493517`*^9}, {
- 3.615264505203335*^9, 3.615264505345048*^9}, {3.615332422765072*^9,
- 3.615332422858425*^9}}],
-
- Cell[BoxData["6"], "Output",
- CellChangeTimes->{{3.615106255367724*^9, 3.615106283906912*^9},
- 3.615106968428494*^9, 3.61510744863015*^9, 3.615107478746314*^9, {
- 3.6151079135471983`*^9, 3.615107930917906*^9}, {3.615185105338943*^9,
- 3.615185125037609*^9}, {3.615190013761879*^9, 3.615190034928678*^9},
- 3.615190197197116*^9, {3.61519024923402*^9, 3.615190277880322*^9},
- 3.6151903383804197`*^9, 3.615190382662181*^9, {3.615190437128523*^9,
- 3.615190462482052*^9}, 3.6151906618319387`*^9, 3.615191640005769*^9,
- 3.615191827602933*^9, 3.6152614828581867`*^9, 3.615262311931246*^9,
- 3.615262475092123*^9, 3.615262533476719*^9, 3.615262624286779*^9,
- 3.61526266205786*^9, 3.6152627385635967`*^9, 3.61526315707622*^9,
- 3.61526322756689*^9, 3.615264507769841*^9, 3.61526459071174*^9,
- 3.615332423734779*^9, 3.615333377784543*^9}],
-
- Cell[BoxData["0"], "Output",
- CellChangeTimes->{{3.615106255367724*^9, 3.615106283906912*^9},
- 3.615106968428494*^9, 3.61510744863015*^9, 3.615107478746314*^9, {
- 3.6151079135471983`*^9, 3.615107930917906*^9}, {3.615185105338943*^9,
- 3.615185125037609*^9}, {3.615190013761879*^9, 3.615190034928678*^9},
- 3.615190197197116*^9, {3.61519024923402*^9, 3.615190277880322*^9},
- 3.6151903383804197`*^9, 3.615190382662181*^9, {3.615190437128523*^9,
- 3.615190462482052*^9}, 3.6151906618319387`*^9, 3.615191640005769*^9,
- 3.615191827602933*^9, 3.6152614828581867`*^9, 3.615262311931246*^9,
- 3.615262475092123*^9, 3.615262533476719*^9, 3.615262624286779*^9,
- 3.61526266205786*^9, 3.6152627385635967`*^9, 3.61526315707622*^9,
- 3.61526322756689*^9, 3.615264507769841*^9, 3.61526459071174*^9,
- 3.615332423734779*^9, 3.615333377789864*^9}],
-
- Cell[BoxData["1"], "Output",
- CellChangeTimes->{{3.615106255367724*^9, 3.615106283906912*^9},
- 3.615106968428494*^9, 3.61510744863015*^9, 3.615107478746314*^9, {
- 3.6151079135471983`*^9, 3.615107930917906*^9}, {3.615185105338943*^9,
- 3.615185125037609*^9}, {3.615190013761879*^9, 3.615190034928678*^9},
- 3.615190197197116*^9, {3.61519024923402*^9, 3.615190277880322*^9},
- 3.6151903383804197`*^9, 3.615190382662181*^9, {3.615190437128523*^9,
- 3.615190462482052*^9}, 3.6151906618319387`*^9, 3.615191640005769*^9,
- 3.615191827602933*^9, 3.6152614828581867`*^9, 3.615262311931246*^9,
- 3.615262475092123*^9, 3.615262533476719*^9, 3.615262624286779*^9,
- 3.61526266205786*^9, 3.6152627385635967`*^9, 3.61526315707622*^9,
- 3.61526322756689*^9, 3.615264507769841*^9, 3.61526459071174*^9,
- 3.615332423734779*^9, 3.615333377793964*^9}],
-
- Cell[BoxData[
- RowBox[{"{",
- RowBox[{
- RowBox[{"{",
- RowBox[{"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}],
- ",",
- RowBox[{"{",
- RowBox[{"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}],
- ",",
- RowBox[{"{",
- RowBox[{"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}],
- ",",
- RowBox[{"{",
- RowBox[{"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}],
- ",",
- RowBox[{"{",
- RowBox[{"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}],
- ",",
- RowBox[{"{",
- RowBox[{"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}]}],
- "}"}]], "Output",
- CellChangeTimes->{{3.615106255367724*^9, 3.615106283906912*^9},
- 3.615106968428494*^9, 3.61510744863015*^9, 3.615107478746314*^9, {
- 3.6151079135471983`*^9, 3.615107930917906*^9}, {3.615185105338943*^9,
- 3.615185125037609*^9}, {3.615190013761879*^9, 3.615190034928678*^9},
- 3.615190197197116*^9, {3.61519024923402*^9, 3.615190277880322*^9},
- 3.6151903383804197`*^9, 3.615190382662181*^9, {3.615190437128523*^9,
- 3.615190462482052*^9}, 3.6151906618319387`*^9, 3.615191640005769*^9,
- 3.615191827602933*^9, 3.6152614828581867`*^9, 3.615262311931246*^9,
- 3.615262475092123*^9, 3.615262533476719*^9, 3.615262624286779*^9,
- 3.61526266205786*^9, 3.6152627385635967`*^9, 3.61526315707622*^9,
- 3.61526322756689*^9, 3.615264507769841*^9, 3.61526459071174*^9,
- 3.615332423734779*^9, 3.615333377798595*^9}]
- }, Open ]],
-
- Cell[BoxData[
- RowBox[{"\[IndentingNewLine]",
- RowBox[{
- RowBox[{
- RowBox[{"addDiag1", "[",
- RowBox[{"x0_", ",", "y0_"}], "]"}], " ", ":=", "\[IndentingNewLine]",
- RowBox[{"Module", "[",
- RowBox[{
- RowBox[{"{",
- RowBox[{
- RowBox[{"x", " ", "=", " ", "x0"}], ",",
- RowBox[{"y", " ", "=", " ", "y0"}]}], "}"}], ",",
- "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"While", "[",
- RowBox[{
- RowBox[{
- RowBox[{"x", "\[NotEqual]", "1"}], "&&",
- RowBox[{"y", "\[NotEqual]", "1"}]}], ",", "\[IndentingNewLine]",
- "\t",
- RowBox[{
- RowBox[{"x", "--"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"y", "--"}]}]}], "]"}], ";", "\[IndentingNewLine]",
- RowBox[{"While", "[",
- RowBox[{
- RowBox[{
- RowBox[{"x", "\[NotEqual]",
- RowBox[{"n", "+", "1"}]}], "&&",
- RowBox[{"y", "\[NotEqual]",
- RowBox[{"n", "+", "1"}]}]}], ",", "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "y"}], "]"}], "]"}], "++"}], ";",
- "\[IndentingNewLine]", "\t",
- RowBox[{"x", "++"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"y", "++"}], ";"}]}], "]"}]}]}], "]"}]}],
- "\[IndentingNewLine]", "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"addDiag2", "[",
- RowBox[{"x0_", ",", "y0_"}], "]"}], " ", ":=", "\[IndentingNewLine]",
- RowBox[{"Module", "[",
- RowBox[{
- RowBox[{"{",
- RowBox[{
- RowBox[{"x", " ", "=", " ", "x0"}], ",", " ",
- RowBox[{"y", " ", "=", " ", "y0"}]}], "}"}], ",",
- "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"While", "[",
- RowBox[{
- RowBox[{
- RowBox[{"x", " ", "\[NotEqual]", "1"}], " ", "&&", " ",
- RowBox[{"y", " ", "\[NotEqual]", " ", "n"}]}], ",",
- "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{"x", "--"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"y", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]",
- RowBox[{"While", "[",
- RowBox[{
- RowBox[{
- RowBox[{"x", "\[NotEqual]",
- RowBox[{"n", "+", "1"}]}], "&&",
- RowBox[{"y", "\[NotEqual]", "0"}]}], ",", "\[IndentingNewLine]",
- "\t",
- RowBox[{
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "y"}], "]"}], "]"}], "++"}], ";",
- "\[IndentingNewLine]", "\t",
- RowBox[{"x", "++"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"y", "--"}], ";"}]}], "]"}]}]}], "]"}]}],
- "\[IndentingNewLine]", "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"removeDiag1", "[",
- RowBox[{"x0_", ",", "y0_"}], "]"}], " ", ":=", "\[IndentingNewLine]",
- RowBox[{"Module", "[",
- RowBox[{
- RowBox[{"{",
- RowBox[{
- RowBox[{"x", " ", "=", " ", "x0"}], ",",
- RowBox[{"y", " ", "=", " ", "y0"}]}], "}"}], ",",
- "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"While", "[",
- RowBox[{
- RowBox[{
- RowBox[{"x", "\[NotEqual]", "1"}], "&&",
- RowBox[{"y", "\[NotEqual]", "1"}]}], ",", "\[IndentingNewLine]",
- "\t",
- RowBox[{
- RowBox[{"x", "--"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"y", "--"}]}]}], "]"}], ";", "\[IndentingNewLine]",
- RowBox[{"While", "[",
- RowBox[{
- RowBox[{
- RowBox[{"x", "\[NotEqual]",
- RowBox[{"n", "+", "1"}]}], "&&",
- RowBox[{"y", "\[NotEqual]",
- RowBox[{"n", "+", "1"}]}]}], ",", "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "y"}], "]"}], "]"}], "--"}], ";",
- "\[IndentingNewLine]", "\t",
- RowBox[{"x", "++"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"y", "++"}], ";"}]}], "]"}]}]}], "]"}]}],
- "\[IndentingNewLine]", "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"removeDiag2", "[",
- RowBox[{"x0_", ",", "y0_"}], "]"}], " ", ":=", "\[IndentingNewLine]",
- RowBox[{"Module", "[",
- RowBox[{
- RowBox[{"{",
- RowBox[{
- RowBox[{"x", " ", "=", " ", "x0"}], ",", " ",
- RowBox[{"y", " ", "=", " ", "y0"}]}], "}"}], ",",
- "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"While", "[",
- RowBox[{
- RowBox[{
- RowBox[{"x", " ", "\[NotEqual]", "1"}], " ", "&&", " ",
- RowBox[{"y", " ", "\[NotEqual]", " ", "n"}]}], ",",
- "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{"x", "--"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"y", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]",
- RowBox[{"While", "[",
- RowBox[{
- RowBox[{
- RowBox[{"x", "\[NotEqual]",
- RowBox[{"n", "+", "1"}]}], "&&",
- RowBox[{"y", "\[NotEqual]", "0"}]}], ",", "\[IndentingNewLine]",
- "\t",
- RowBox[{
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"x", ",", "y"}], "]"}], "]"}], "--"}], ";",
- "\[IndentingNewLine]", "\t",
- RowBox[{"x", "++"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"y", "--"}], ";"}]}], "]"}]}]}], "]"}]}],
- "\[IndentingNewLine]", "\[IndentingNewLine]",
- RowBox[{
- RowBox[{"solveNQ", "[", "row_", "]"}], " ", ":=", " ",
- "\[IndentingNewLine]",
- RowBox[{"If", "[",
- RowBox[{
- RowBox[{"q", " ", "\[Equal]", " ", "n"}], ",", " ",
- RowBox[{"Return", " ", "True"}]}], "]"}]}], "\[IndentingNewLine]",
- RowBox[{"If", "[",
- RowBox[{
- RowBox[{"q", " ", "<", " ", "n"}], ",", "\[IndentingNewLine]", "\t",
- RowBox[{"For", "[",
- RowBox[{
- RowBox[{"i", " ", "=", " ", "1"}], ",", " ",
- RowBox[{"i", " ", "\[LessEqual]", " ", "n"}], ",", " ",
- RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", "\t\t",
- RowBox[{"If", "[",
- RowBox[{
- RowBox[{
- RowBox[{"board", "[",
- RowBox[{"[",
- RowBox[{"row", ",", "i"}], "]"}], "]"}], "\[Equal]", " ", "0"}],
- ",", "\[IndentingNewLine]", "\t\t",
- RowBox[{
- RowBox[{"addQueen", "[",
- RowBox[{"row", ",", " ", "i"}], "]"}], ";", "\[IndentingNewLine]",
- "\t\t",
- RowBox[{"If", "[",
- RowBox[{
- RowBox[{
- RowBox[{"solveNQ", "[",
- RowBox[{"row", "+", "1"}], "]"}], " ", "\[Equal]", " ",
- "True"}], ",", "\[IndentingNewLine]", "\t\t",
- RowBox[{"Return", " ", "True"}], ",", "\[IndentingNewLine]",
- "\t\t",
- RowBox[{"removeQueen", "[",
- RowBox[{"row", ",", " ", "i"}], "]"}]}], "\[IndentingNewLine]",
- "]"}]}]}], "]"}]}], "]"}], ",",
- RowBox[{"Return", " ", "False"}]}], "]"}], "\[IndentingNewLine]",
- "\[IndentingNewLine]"}]}]], "Input",
- CellChangeTimes->{{3.6140882860306892`*^9, 3.614088356222574*^9}, {
- 3.614088407482459*^9, 3.6140884088398943`*^9}, {3.614088441634379*^9,
- 3.6140884423723*^9}, {3.614088490098531*^9, 3.6140885902695923`*^9}, {
- 3.6140886960238657`*^9, 3.614088726433132*^9}, 3.614089090947764*^9, {
- 3.614089139366663*^9, 3.6140891440108967`*^9}, {3.614089227679269*^9,
- 3.614089228765727*^9}, {3.614090051988195*^9, 3.614090063043016*^9}, {
- 3.6140900943276653`*^9, 3.614090117715989*^9}, {3.614090204529945*^9,
- 3.614090210262413*^9}, {3.614090263360017*^9, 3.61409026573615*^9}, {
- 3.614090382564814*^9, 3.614090386051043*^9}, {3.614093879551062*^9,
- 3.614093881943919*^9}, {3.614095376704281*^9, 3.614095382549965*^9}, {
- 3.6140954633993196`*^9, 3.614095498136191*^9}, {3.614095800754363*^9,
- 3.614095827899227*^9}, 3.614096884406939*^9, {3.6140969410146723`*^9,
- 3.614096972295486*^9}, {3.6140970611881237`*^9, 3.6140970897774754`*^9}, {
- 3.6140983955254307`*^9, 3.6140984016668043`*^9}, {3.614098691252757*^9,
- 3.614098711506929*^9}, {3.614098749115408*^9, 3.614098766143446*^9}, {
- 3.6141250157128143`*^9, 3.614125020870408*^9}, {3.614125089209598*^9,
- 3.6141251139686127`*^9}, {3.614125242684229*^9, 3.6141252524445467`*^9}, {
- 3.614225752833281*^9, 3.614225759225267*^9}, {3.614225795674617*^9,
- 3.614225803058391*^9}, {3.614228169553487*^9, 3.6142281914864407`*^9}, {
- 3.614228262014213*^9, 3.614228444901247*^9}, {3.614296503441597*^9,
- 3.6142965153274508`*^9}, {3.614296643570386*^9, 3.614296681054344*^9}, {
- 3.614297024104217*^9, 3.6142970681013193`*^9}, {3.6150039036360207`*^9,
- 3.6150039275940228`*^9}, {3.6151001122139397`*^9, 3.615100379691326*^9}, {
- 3.615100413677575*^9, 3.61510044643744*^9}, {3.615101476187705*^9,
- 3.615101552163875*^9}, {3.615101619029747*^9, 3.615101625804593*^9}, {
- 3.6151019977748632`*^9, 3.615102007495118*^9}, {3.6151069462614527`*^9,
- 3.615106946779744*^9}, 3.615239106664412*^9, 3.615640883087833*^9, {
- 3.615640920905452*^9, 3.615640965899955*^9}}],
-
- Cell[BoxData[
- RowBox[{"\[IndentingNewLine]",
- RowBox[{
- RowBox[{"brownBySix", ":=", "\[IndentingNewLine]",
- RowBox[{"If", "[",
- RowBox[{
- RowBox[{
- RowBox[{"Mod", "[",
- RowBox[{"n", ",", "6"}], "]"}], "\[Equal]", "0"}], ",",
- "\[IndentingNewLine]",
- RowBox[{"For", "[",
- RowBox[{
- RowBox[{"u", " ", "=", " ", "1"}], ",", " ",
- RowBox[{"u", " ", "\[LessEqual]", " ",
- RowBox[{"n", "/", "3"}]}], ",", " ",
- RowBox[{"u", "++"}], ",", "\[IndentingNewLine]", "\t",
- RowBox[{
- RowBox[{"addQueen", "[",
- RowBox[{"u", ",",
- RowBox[{"3", "u"}]}], "]"}], ";", "\[IndentingNewLine]", "\t",
- RowBox[{"addQueen", "[",
- RowBox[{
- RowBox[{"u", " ", "+", " ",
- RowBox[{"n", "/", "3"}]}], ",", " ",
- RowBox[{
- RowBox[{"3", "u"}], " ", "-", " ", "1"}]}], "]"}], ";",
- "\[IndentingNewLine]", "\t",
- RowBox[{"addQueen", "[",
- RowBox[{
- RowBox[{"u", " ", "+", " ",
- RowBox[{"2",
- RowBox[{"n", "/", "3"}]}]}], ",", " ",
- RowBox[{
- RowBox[{"3", "u"}], " ", "-", " ", "2"}]}], "]"}]}]}],
- "\[IndentingNewLine]", "\t", "]"}]}], "]"}]}], "\[IndentingNewLine]",
- "\[IndentingNewLine]"}]}]], "Input",
- CellChangeTimes->{{3.614125139338093*^9, 3.614125142875205*^9}, {
- 3.6141254166326303`*^9, 3.614125422422567*^9}, 3.6142257085838127`*^9, {
- 3.614228452683065*^9, 3.614228456343454*^9}, {3.614228625918419*^9,
- 3.614228648486783*^9}, 3.614228974544014*^9, {3.614229034041863*^9,
- 3.6142291340188227`*^9}, {3.6142291688925*^9, 3.614229261196371*^9}, {
- 3.614229319113182*^9, 3.614229361896606*^9}, {3.614229392723219*^9,
- 3.614229400714045*^9}, {3.6142294366931553`*^9, 3.614229501900256*^9},
- 3.6142738652163687`*^9, {3.614274102765471*^9, 3.614274221660686*^9}, {
- 3.6142744701533337`*^9, 3.6142744787674026`*^9}, {3.6142748408168907`*^9,
- 3.614274847336853*^9}, {3.614274878489946*^9, 3.6142748786495523`*^9}, {
- 3.61427490975418*^9, 3.614274917106642*^9}, {3.614274961444104*^9,
- 3.6142749714043217`*^9}, {3.614295974161104*^9, 3.614295982703451*^9}, {
- 3.6142972168331614`*^9, 3.614297255648562*^9}, {3.615106291105151*^9,
- 3.61510631177634*^9}, {3.615106369537963*^9, 3.615106369889958*^9}, {
- 3.615106880722383*^9, 3.615106884400844*^9}, {3.615106978052498*^9,
- 3.6151069794345427`*^9}, {3.615107020380588*^9, 3.615107023339645*^9}, {
- 3.615107219467105*^9, 3.615107222689253*^9}, {3.615107336246387*^9,
- 3.615107341124178*^9}, {3.615107379175962*^9, 3.615107379661982*^9}, {
- 3.615107456561517*^9, 3.615107462247404*^9}, {3.615107522482216*^9,
- 3.6151075394581327`*^9}, {3.615107618822316*^9, 3.615107622267558*^9}, {
- 3.615185113782856*^9, 3.615185113851839*^9}, {3.6151900259295673`*^9,
- 3.6151900477079563`*^9}, {3.615191652847473*^9, 3.615191680955138*^9}, {
- 3.6151918108320923`*^9, 3.6151918181906548`*^9}, {3.6151918576333313`*^9,
- 3.6151919947074003`*^9}, {3.6151920909747877`*^9, 3.615192109142665*^9}, {
- 3.6151921822428083`*^9, 3.615192215769335*^9}, {3.615192264171521*^9,
- 3.6151922900195*^9}, {3.615192326296124*^9, 3.6151923753256617`*^9}, {
- 3.615192426682247*^9, 3.615192427534871*^9}, {3.615192633710935*^9,
- 3.615192641419223*^9}, {3.615261495850395*^9, 3.61526152503197*^9}, {
- 3.6152615927075033`*^9, 3.6152617497662697`*^9}, {3.61526178753685*^9,
- 3.615261861017095*^9}, {3.615261935275077*^9, 3.6152619675637712`*^9}, {
- 3.615262041377157*^9, 3.615262064374447*^9}, {3.615262342951951*^9,
- 3.6152624639934397`*^9}, {3.615262617778508*^9, 3.6152626499827623`*^9}, {
- 3.615262733504818*^9, 3.615262734172369*^9}, {3.615262789445963*^9,
- 3.615262798842525*^9}, {3.615263162798306*^9, 3.615263305983286*^9}, {
- 3.615264512347466*^9, 3.615264585091168*^9}, 3.615640892105657*^9, {
- 3.615640972797007*^9, 3.61564097643475*^9}}]
- },
- WindowSize->{983, 947},
- WindowMargins->{{Automatic, 133}, {38, Automatic}},
- FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (June 27, \
- 2014)",
- StyleDefinitions->"Default.nb"
- ]
- (* End of Notebook Content *)
-
- (* Internal cache information *)
- (*CellTagsOutline
- CellTagsIndex->{}
- *)
- (*CellTagsIndex
- CellTagsIndex->{}
- *)
- (*NotebookFileOutline
- Notebook[{
- Cell[CellGroupData[{
- Cell[579, 22, 5220, 115, 403, "Input"],
- Cell[5802, 139, 856, 12, 28, "Output"],
- Cell[6661, 153, 856, 12, 28, "Output"],
- Cell[7520, 167, 856, 12, 28, "Output"],
- Cell[8379, 181, 1498, 32, 28, "Output"]
- }, Open ]],
- Cell[9892, 216, 9170, 213, 913, "Input"],
- Cell[19065, 431, 3990, 71, 182, "Input"]
- }
- ]
- *)
-
- (* End of internal cache information *)
|