(* 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[ 64401, 1693] NotebookOptionsPosition[ 63167, 1650] NotebookOutlinePosition[ 63509, 1665] CellTagsIndexPosition[ 63466, 1662] WindowFrame->Normal ContainsDynamic->True *) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"2", ",", "3", ",", "4", ",", "8", ",", "9"}], "}"}], ",", RowBox[{"{", "16", "}"}]}], "}"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Clear", "[", "x", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"Expand", "[", RowBox[{ RowBox[{"Cyclotomic", "[", RowBox[{"2", ",", "x"}], "]"}], RowBox[{"Cyclotomic", "[", RowBox[{"4", ",", "x"}], "]"}], RowBox[{"Cyclotomic", "[", RowBox[{"8", ",", "x"}], "]"}]}], "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]"}]}]], "Input", CellChangeTimes->{{3.433606930796875*^9, 3.433606988171875*^9}}], Cell[BoxData[ RowBox[{"1", "+", "x", "+", SuperscriptBox["x", "2"], "+", SuperscriptBox["x", "3"], "+", SuperscriptBox["x", "4"], "+", SuperscriptBox["x", "5"], "+", SuperscriptBox["x", "6"], "+", SuperscriptBox["x", "7"]}]], "Output", CellChangeTimes->{3.433607657828125*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "This", " ", "section", " ", "alone", " ", "is", " ", "the", " ", "\"\\"", "n", "\"\< and a set \n\>\"", "B", "\"\< at the beginning and then run it. It gives you ALL the tiling \ complements of B in the group Z_n. Try to play with it in different groups. \ Z_108, Z_120, etc. It runs remarkably fast, as long as the number of tiling \ complements is not more than a few thousand. It takes longer if it is \ something like 100000, and takes 2-3 days if it is 1000000. Please use it at \ your wish. For example it is funny to give n=1000 and a random set B of \ length 20, and see how quickly it decides whether there are any tilining \ complements of B. Of course, almost surely B will have no tiling complements, \ and this procedure will run within 1-2 minutes. \n\nWe should find the tiling \ complements of B modulo 16 and then shift the elements by multiples of 16; in \ that way we get all tiles B modulo 144 with SA={16}. Instead we shift B by \ multiples of 16 and run the fill-out procedure modulo 144. This is \ equivalent. We get all the desired tiles B with SA={16}.\n\n \>"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"{", RowBox[{"i", ",", "g", ",", " ", "mark"}], "}"}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Clear", "[", RowBox[{ "n", ",", "B", ",", "R", ",", "Tile", ",", "A", ",", "U", ",", "mark", ",", "T", ",", "g"}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", "144"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"B", "=", RowBox[{"{", RowBox[{ "0", ",", "1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"B", "=", RowBox[{"B", "\[Union]", RowBox[{"(", RowBox[{"B", "+", "16"}], ")"}], "\[Union]", RowBox[{"(", RowBox[{"B", "+", "32"}], ")"}], "\[Union]", RowBox[{"(", RowBox[{"B", "+", "48"}], ")"}], "\[Union]", RowBox[{"(", RowBox[{"B", "+", "64"}], ")"}], "\[Union]", RowBox[{"(", RowBox[{"B", "+", "80"}], ")"}], "\[Union]", RowBox[{"(", RowBox[{"B", "+", "96"}], ")"}], "\[Union]", RowBox[{"(", RowBox[{"B", "+", "112"}], ")"}], "\[Union]", RowBox[{"(", RowBox[{"B", "+", "128"}], ")"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Tile", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", "1000000"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"R", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"A", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"n", "/", RowBox[{"Length", "[", "B", "]"}]}], ",", "n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"U", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"n", "/", RowBox[{"Length", "[", "B", "]"}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"U", "[", RowBox[{"[", "1", "]"}], "]"}], "=", "B"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"mark", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"1", "&"}], ",", RowBox[{ RowBox[{"n", "/", RowBox[{"Length", "[", "B", "]"}]}], "+", "1"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"T", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{ RowBox[{"{", "0", "}"}], "&"}], ",", RowBox[{"n", "/", RowBox[{"Length", "[", "B", "]"}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"g", "=", "1"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", " ", RowBox[{"i", ">", "0"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Length", "[", RowBox[{"U", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "\[Equal]", "n"}], ",", " ", RowBox[{ RowBox[{ RowBox[{"Tile", "[", RowBox[{"[", "g", "]"}], "]"}], "=", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "\[Union]", RowBox[{"{", "}"}]}]}], ";", RowBox[{"g", "=", RowBox[{"g", "+", "1"}]}], ";", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}]}], ";", RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "1"}], ";", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{"n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{"i", "=", RowBox[{"i", "-", "1"}]}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", " ", RowBox[{"j", "\[LessEqual]", "n"}], ",", RowBox[{ RowBox[{"k", "=", "100"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Not", "[", RowBox[{"MemberQ", "[", RowBox[{ RowBox[{"U", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"Mod", "[", RowBox[{"j", ",", "n"}], "]"}]}], "]"}], "]"}], ",", " ", RowBox[{ RowBox[{"k", "=", "0"}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"m", "=", "1"}], ",", " ", RowBox[{"m", "\[LessEqual]", RowBox[{"Length", "[", "B", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"U", "[", RowBox[{"[", "i", "]"}], "]"}], "\[Intersection]", " ", RowBox[{"Mod", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"j", "-", RowBox[{"B", "[", RowBox[{"[", "m", "]"}], "]"}]}], ")"}], "+", "B"}], ",", "n"}], "]"}]}], "\[Equal]", RowBox[{"{", "}"}]}], ",", " ", RowBox[{ RowBox[{"k", "=", RowBox[{"k", "+", "1"}]}], ";", " ", RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", "j", ",", "m"}], "]"}], "]"}], "=", RowBox[{"Mod", "[", RowBox[{ RowBox[{"j", "-", RowBox[{"B", "[", RowBox[{"[", "m", "]"}], "]"}]}], ",", "n"}], "]"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"m", "++"}]}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"R", "[", RowBox[{"[", "j", "]"}], "]"}], "=", "k"}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"min", "=", RowBox[{"Min", "[", "R", "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"(", RowBox[{"Not", "[", RowBox[{"min", "\[Equal]", "0"}], "]"}], ")"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"Catch", "[", RowBox[{"Do", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"R", "[", RowBox[{"[", "ii", "]"}], "]"}], "\[Equal]", "min"}], ",", " ", RowBox[{"Throw", "[", "ii", "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"ii", ",", "n"}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "\[LessEqual]", RowBox[{"Length", "[", "B", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"b", "=", RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", " ", RowBox[{"b", "<=", RowBox[{"Length", "[", "B", "]"}]}], ",", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"b", "+", "1"}]}], ";", RowBox[{"z", "=", "0"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Not", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", "t", ",", "b"}], "]"}], "]"}], "\[Equal]", "200"}], "]"}], ",", " ", RowBox[{ RowBox[{ RowBox[{"U", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"U", "[", RowBox[{"[", "i", "]"}], "]"}], "\[Union]", RowBox[{"Mod", "[", RowBox[{ RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", "t", ",", "b"}], "]"}], "]"}], "+", "B"}], ",", "n"}], "]"}]}]}], ";", " ", RowBox[{ RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "\[Union]", RowBox[{"{", RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", "t", ",", "b"}], "]"}], "]"}], "}"}]}]}], ";", " ", RowBox[{"b", "=", RowBox[{ RowBox[{"Length", "[", "B", "]"}], "+", "1"}]}], ";", RowBox[{"z", "=", "1"}], ";", RowBox[{"i", "=", RowBox[{"i", "+", "1"}]}], ";"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"b", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"z", "==", "0"}], ",", " ", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "1"}], ";", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{"n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{"i", "=", RowBox[{"i", "-", "1"}]}]}]}], "]"}], ";"}], "\[IndentingNewLine]", ",", " ", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "1"}], ";", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{"n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}]}], ";", RowBox[{"i", "=", RowBox[{"i", "-", "1"}]}]}]}], "]"}], ";"}], "\[IndentingNewLine]", ",", " ", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "1"}], ";", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{"n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}]}], ";", RowBox[{"i", "=", RowBox[{"i", "-", "1"}]}]}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Tile", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Tile", "\[Union]", RowBox[{"{", "}"}]}], ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Length", "[", "Tile", "]"}], "\[IndentingNewLine]", RowBox[{"Tile", ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]"}]}]], "Input", CellChangeTimes->{{3.433606990109375*^9, 3.433607006140625*^9}, { 3.433607666125*^9, 3.4336076680625*^9}, {3.433607941546875*^9, 3.43360811346875*^9}}], Cell[BoxData[ DynamicBox[ ToBoxes[{$CellContext`i, $CellContext`g, $CellContext`mark}, StandardForm], ImageSizeCache->{187.5, {2., 8.}}]], "Output", CellChangeTimes->{3.43360768715625*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ "0", ",", "1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",", "16", ",", "17", ",", "18", ",", "19", ",", "20", ",", "21", ",", "22", ",", "23", ",", "32", ",", "33", ",", "34", ",", "35", ",", "36", ",", "37", ",", "38", ",", "39", ",", "48", ",", "49", ",", "50", ",", "51", ",", "52", ",", "53", ",", "54", ",", "55", ",", "64", ",", "65", ",", "66", ",", "67", ",", "68", ",", "69", ",", "70", ",", "71", ",", "80", ",", "81", ",", "82", ",", "83", ",", "84", ",", "85", ",", "86", ",", "87", ",", "96", ",", "97", ",", "98", ",", "99", ",", "100", ",", "101", ",", "102", ",", "103", ",", "112", ",", "113", ",", "114", ",", "115", ",", "116", ",", "117", ",", "118", ",", "119", ",", "128", ",", "129", ",", "130", ",", "131", ",", "132", ",", "133", ",", "134", ",", "135"}], "}"}]], "Output", CellChangeTimes->{3.433607687203125*^9}], Cell[BoxData["9"], "Output", CellChangeTimes->{3.4336076999375*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{ "In", " ", "this", " ", "step", " ", "we", " ", "are", " ", "going", " ", "to", " ", "throw", " ", "away", " ", "the", " ", "periodic", " ", "sets", " ", "from", " ", RowBox[{"Tile", ".", " ", "And"}], " ", "also"}], ",", " ", RowBox[{ "we", " ", "want", " ", "to", " ", "keep", " ", "only", " ", "one", " ", "copy", " ", "of", " ", "equivalent", " ", "tiles", " ", RowBox[{ RowBox[{"(", RowBox[{ "a", " ", "tile", " ", "is", " ", "equivalent", " ", "to", " ", "its", " ", "own", " ", "translated", " ", "coppies"}], ")"}], ".", " ", "We"}], " ", "only", " ", "want", " ", "to", " ", "keep", " ", "the", " ", "ones", " ", "in", " ", "normal", " ", RowBox[{"form", ".", " ", "The"}], " ", "normal", " ", "form", " ", "i", " ", "chose", " ", "here", " ", "is", " ", "that", " ", "the", " ", "longest", " ", "interval", " ", "is", " ", "thrown", " ", "in", " ", "at", " ", "the", " ", RowBox[{"beginning", "."}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", " ", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "Tile", "]"}]}], ",", " ", RowBox[{ RowBox[{"P", "=", RowBox[{"Tile", "[", RowBox[{"[", "j", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "2"}], ",", " ", RowBox[{"i", "<=", RowBox[{"Length", "[", "P", "]"}]}], ",", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"MemberQ", "[", RowBox[{"Tile", ",", RowBox[{ RowBox[{"Mod", "[", RowBox[{ RowBox[{"P", "-", RowBox[{"P", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", "n"}], "]"}], "\[Union]", RowBox[{"{", "}"}]}]}], "]"}], ",", " ", RowBox[{ RowBox[{ RowBox[{"Tile", "[", RowBox[{"[", "j", "]"}], "]"}], "=", "0"}], ";", RowBox[{"i", "=", RowBox[{ RowBox[{"Length", "[", "P", "]"}], "+", "1"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"i", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";"}], " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"Tile", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Tile", "\[Union]", RowBox[{"{", "}"}]}], ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Length", "[", "Tile", "]"}], "\[IndentingNewLine]", "Tile", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]"}]}]], "Input", CellChangeTimes->{{3.433607040875*^9, 3.4336070424375*^9}}], Cell[BoxData["4"], "Output", CellChangeTimes->{3.433607717078125*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "88"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "104"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "120"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "136"}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.433607717078125*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{ "This", " ", "step", " ", "is", " ", "a", " ", "seemingly", " ", "long", " ", "code"}], ",", " ", RowBox[{ RowBox[{"but", " ", RowBox[{"it", "'"}], "s", " ", "task", " ", "is", " ", RowBox[{"simple", ".", " ", "You"}], " ", "must", " ", "give", " ", "a", " ", "value", " ", "\"\\"", " ", "and", " ", "a", " ", "list", " ", "of", " ", "sets", " ", "\"\\"", " ", "at", " ", "the", " ", "beginning", " ", "as", " ", RowBox[{"input", ".", " ", "What"}], " ", "it", " ", RowBox[{"does", ":", " ", RowBox[{ "it", " ", "puts", " ", "the", " ", "sets", " ", "in", " ", "T2", " ", "into", " ", "equvalence", " ", "classes", " ", "according", " ", "to", " ", "which", " ", "cyclotomic", " ", "polynomials", " ", "divide", " ", RowBox[{"them", ".", " ", "In"}], " ", "this", " ", "case", " ", "n"}]}]}], "=", RowBox[{ RowBox[{"144", " ", "and", " ", "T2"}], "=", RowBox[{"Tile", " ", "from", " ", "the", " ", "previous", " ", RowBox[{"step", "."}]}]}]}]}], " ", "\[IndentingNewLine]", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"n", "=", "144"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"T2", "=", "Tile"}], ";"}], "\[IndentingNewLine]", " ", "\[IndentingNewLine]", RowBox[{"Dynamic", "[", RowBox[{"{", RowBox[{"j", ",", "v", ",", "vvv", ",", "vvvv"}], "}"}], "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Clear", "[", "H", "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Length", "[", "T2", "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"H", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Length", "[", "T2", "]"}], ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MF", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", "100"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MT", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", "100"}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", " ", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "T2", "]"}]}], ",", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"k", "=", "1"}], ",", " ", RowBox[{"k", "\[LessEqual]", "n"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"MemberQ", "[", RowBox[{ RowBox[{"T2", "[", RowBox[{"[", "j", "]"}], "]"}], ",", RowBox[{"Mod", "[", RowBox[{"k", ",", "n"}], "]"}]}], "]"}], ",", RowBox[{ RowBox[{"H", "[", RowBox[{"[", RowBox[{"j", ",", "k"}], "]"}], "]"}], "=", "1"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"k", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"MF", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{"H", "[", RowBox[{"[", "1", "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"MT", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{"T2", "[", RowBox[{"[", "1", "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"cont", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"v", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "2"}], ",", " ", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "T2", "]"}]}], ",", " ", RowBox[{ RowBox[{"cont", "=", "1"}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"c", "=", "1"}], ",", RowBox[{"c", "\[LessEqual]", "v"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"k", "=", "1"}], ",", " ", RowBox[{"k", "\[LessEqual]", "n"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"Not", "[", RowBox[{ RowBox[{ RowBox[{"Chop", "[", RowBox[{"Fourier", "[", RowBox[{"MF", "[", RowBox[{"[", "c", "]"}], "]"}], "]"}], "]"}], "[", RowBox[{"[", "k", "]"}], "]"}], "==", RowBox[{ RowBox[{"Chop", "[", RowBox[{"Fourier", "[", RowBox[{"H", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}], "]"}], "[", RowBox[{"[", "k", "]"}], "]"}]}], "]"}], ")"}], "\[And]", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Chop", "[", RowBox[{"Fourier", "[", RowBox[{"MF", "[", RowBox[{"[", "c", "]"}], "]"}], "]"}], "]"}], "[", RowBox[{"[", "k", "]"}], "]"}], "\[Equal]", "0"}], "\[Or]", RowBox[{ RowBox[{ RowBox[{"Chop", "[", RowBox[{"Fourier", "[", RowBox[{"H", "[", RowBox[{"[", "j", "]"}], "]"}], "]"}], "]"}], "[", RowBox[{"[", "k", "]"}], "]"}], "\[Equal]", "0"}]}], ")"}]}], ",", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"k", "=", RowBox[{"n", "+", "1"}]}], ";", RowBox[{"cont", "=", RowBox[{"cont", "+", "1"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"k", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"cont", "\[LessEqual]", "c"}], ",", " ", RowBox[{"c", "=", RowBox[{"v", "+", "1"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"c", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"cont", "\[Equal]", RowBox[{"v", "+", "1"}]}], ",", " ", RowBox[{ RowBox[{ RowBox[{"MF", "[", RowBox[{"[", RowBox[{"v", "+", "1"}], "]"}], "]"}], "=", RowBox[{"H", "[", RowBox[{"[", "j", "]"}], "]"}]}], ";", RowBox[{ RowBox[{"MT", "[", RowBox[{"[", RowBox[{"v", "+", "1"}], "]"}], "]"}], "=", RowBox[{"T2", "[", RowBox[{"[", "j", "]"}], "]"}]}], ";", " ", RowBox[{"v", "=", RowBox[{"v", "+", "1"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";"}], " ", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"MT", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"MT", "\[Union]", RowBox[{"{", "}"}]}], ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MF", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"MF", "\[Union]", RowBox[{"{", "}"}]}], ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Length", "[", "MF", "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "MT", "\[IndentingNewLine]", "\[IndentingNewLine]", " ", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Next", ",", " ", RowBox[{ RowBox[{"we", " ", "see", " ", "what", " ", "those", " ", "Fourier"}], "-", RowBox[{"zero", " ", "sets", " ", RowBox[{"are", "."}]}]}]}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"J", "=", "MF"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"F1", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"1", "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Length", "[", "J", "]"}], ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "<=", RowBox[{"Length", "[", "J", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", "n"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Chop", "[", RowBox[{"Fourier", "[", RowBox[{"J", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}], "[", RowBox[{"[", "j", "]"}], "]"}], "\[Equal]", "0"}], ",", " ", RowBox[{ RowBox[{"F1", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", "0"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"i", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"F1", ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"FF1", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Length", "[", "F1", "]"}], ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", RowBox[{"Length", "[", "F1", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", "n"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"F1", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "\[Equal]", "0"}], ",", " ", RowBox[{ RowBox[{"FF1", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", "j"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"i", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "FF1", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"FF1", "[", RowBox[{"[", "j", "]"}], "]"}], "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{ RowBox[{"FF1", "[", RowBox[{"[", "j", "]"}], "]"}], "\[Union]", RowBox[{"{", "}"}]}], ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"FF1", ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"FF", "=", RowBox[{"FF1", "-", "1"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m", "=", "1"}], ",", RowBox[{"m", "\[LessEqual]", RowBox[{"Length", "[", "FF1", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", RowBox[{"FF1", "[", RowBox[{"[", "m", "]"}], "]"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"FF", "[", RowBox[{"[", RowBox[{"m", ",", "j"}], "]"}], "]"}], "=", RowBox[{"GCD", "[", RowBox[{ RowBox[{"FF", "[", RowBox[{"[", RowBox[{"m", ",", "j"}], "]"}], "]"}], ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"m", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"FF", ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "FF", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"FF", "[", RowBox[{"[", "j", "]"}], "]"}], "=", RowBox[{ RowBox[{"FF", "[", RowBox[{"[", "j", "]"}], "]"}], "\[Union]", RowBox[{"{", "}"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"FF", ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"FT", "=", RowBox[{"n", "/", "FF"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"CFT", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"Length", "[", "FT", "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "FT", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"CFT", "[", RowBox[{"[", "j", "]"}], "]"}], "=", RowBox[{"Complement", "[", RowBox[{ RowBox[{"Divisors", "[", "n", "]"}], ",", RowBox[{"FT", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "CFT", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]"}]}]], "Input", CellChangeTimes->{{3.43360706234375*^9, 3.43360706315625*^9}}], Cell[BoxData[ DynamicBox[ ToBoxes[{$CellContext`j, $CellContext`v, $CellContext`vvv, \ $CellContext`vvvv}, StandardForm], ImageSizeCache->{110.5625, {2., 8.}}]], "Output", CellChangeTimes->{3.4336077280625*^9}], Cell[BoxData["4"], "Output", CellChangeTimes->{3.433607728109375*^9}], Cell[BoxData["2"], "Output", CellChangeTimes->{3.433607728328125*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "88"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "120"}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.43360772834375*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"48", ",", "16"}], "}"}], ",", RowBox[{"{", "16", "}"}]}], "}"}]], "Output", CellChangeTimes->{3.43360772840625*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "1", ",", "2", ",", "3", ",", "4", ",", "6", ",", "8", ",", "9", ",", "12", ",", "18", ",", "24", ",", "36", ",", "72", ",", "144"}], "}"}], ",", RowBox[{"{", RowBox[{ "1", ",", "2", ",", "3", ",", "4", ",", "6", ",", "8", ",", "9", ",", "12", ",", "18", ",", "24", ",", "36", ",", "48", ",", "72", ",", "144"}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.433607728421875*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "We", " ", "see", " ", "that", " ", "all", " ", "tiling", " ", "complements", " ", "A", " ", "must", " ", "be", " ", RowBox[{"periodic", "."}]}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.433608143125*^9, 3.433608164796875*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ RowBox[{"This", " ", "is", " ", "just", " ", "crosscheking"}], ",", " ", RowBox[{"not", " ", "really", " ", RowBox[{"necessary", ".", " ", "Looking"}], " ", "at", " ", "\"\\"", " ", "we", " ", "indeed", " ", "see", " ", "that", " ", "all", " ", "complements", " ", "must", " ", "be", " ", RowBox[{"periodic", ".", "\[IndentingNewLine]", "The"}], " ", "maxperiod", " ", "procedure", " ", "is", " ", "explained", " ", "in", " ", "the", " ", "music3816vs249commented", " ", RowBox[{"file", "."}]}]}], " ", "\[IndentingNewLine]", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"{", RowBox[{ "jj", ",", "j", ",", "i", ",", "g", ",", " ", "mark", ",", " ", "rr"}], "}"}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Clear", "[", RowBox[{ "n", ",", "J", ",", "B", ",", "R", ",", "Tile", ",", "A", ",", "U", ",", "mark", ",", "T", ",", "g", ",", "x"}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", "144"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"J", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "88"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "120"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"rr", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"gcd", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Length", "[", "J", "]"}], ",", RowBox[{"Length", "[", RowBox[{"J", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"kk", "=", "1"}], ",", RowBox[{"kk", "\[LessEqual]", RowBox[{"Length", "[", "J", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"mm", "=", "2"}], ",", RowBox[{"mm", "\[LessEqual]", RowBox[{"Length", "[", RowBox[{"J", "[", RowBox[{"[", "kk", "]"}], "]"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"gcd", "[", RowBox[{"[", RowBox[{"kk", ",", "mm"}], "]"}], "]"}], "=", RowBox[{"GCD", "[", RowBox[{ RowBox[{"gcd", "[", RowBox[{"[", RowBox[{"kk", ",", RowBox[{"mm", "-", "1"}]}], "]"}], "]"}], ",", RowBox[{"J", "[", RowBox[{"[", RowBox[{"kk", ",", "mm"}], "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"mm", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"kk", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"kk", "=", "1"}], ",", RowBox[{"kk", "\[LessEqual]", RowBox[{"Length", "[", "J", "]"}]}], ",", " ", RowBox[{ RowBox[{ RowBox[{"gcd", "[", RowBox[{"[", RowBox[{"kk", ",", RowBox[{"Length", "[", RowBox[{"J", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], "]"}], "]"}], "=", RowBox[{"GCD", "[", RowBox[{ RowBox[{"gcd", "[", RowBox[{"[", RowBox[{"kk", ",", RowBox[{"Length", "[", RowBox[{"J", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], "]"}], "]"}], ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"kk", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"maxperiod", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Length", "[", "J", "]"}], ",", "10000"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"jj", "=", "1"}], ",", " ", RowBox[{"jj", "\[LessEqual]", RowBox[{"Length", "[", "J", "]"}]}], ",", RowBox[{ RowBox[{"Clear", "[", RowBox[{ "B", ",", "R", ",", "Tile", ",", "A", ",", "U", ",", "mark", ",", "T", ",", "g", ",", "x"}], "]"}], ";", RowBox[{"n", "=", "144"}], ";", RowBox[{"n", "=", RowBox[{"n", "/", RowBox[{"gcd", "[", RowBox[{"[", RowBox[{"jj", ",", " ", RowBox[{"Length", "[", RowBox[{"J", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], "]"}], "]"}]}]}], ";", RowBox[{"B", "=", RowBox[{ RowBox[{"J", "[", RowBox[{"[", "jj", "]"}], "]"}], "/", RowBox[{"gcd", "[", RowBox[{"[", RowBox[{"jj", ",", RowBox[{"Length", "[", RowBox[{"J", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], "]"}], "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Tile", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", "100000"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"R", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"A", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"n", "/", RowBox[{"Length", "[", "B", "]"}]}], ",", "n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"U", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"n", "/", RowBox[{"Length", "[", "B", "]"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"U", "[", RowBox[{"[", "1", "]"}], "]"}], "=", "B"}], ";", "\[IndentingNewLine]", RowBox[{"mark", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"1", "&"}], ",", RowBox[{ RowBox[{"n", "/", RowBox[{"Length", "[", "B", "]"}]}], "+", "1"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"T", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{ RowBox[{"{", "0", "}"}], "&"}], ",", RowBox[{"n", "/", RowBox[{"Length", "[", "B", "]"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"g", "=", "1"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", " ", RowBox[{"i", ">", "0"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Length", "[", RowBox[{"U", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "\[Equal]", "n"}], ",", " ", RowBox[{ RowBox[{ RowBox[{"Tile", "[", RowBox[{"[", "g", "]"}], "]"}], "=", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "\[Union]", RowBox[{"{", "}"}]}]}], ";", RowBox[{ RowBox[{"maxperiod", "[", RowBox[{"[", RowBox[{"jj", ",", "g"}], "]"}], "]"}], "=", "99"}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"ff", "=", RowBox[{ RowBox[{"Length", "[", RowBox[{"Divisors", "[", "n", "]"}], "]"}], "-", "1"}]}], ",", " ", RowBox[{"ff", ">", "0"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Mod", "[", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Divisors", "[", "n", "]"}], "[", RowBox[{"[", "ff", "]"}], "]"}], ")"}], "+", RowBox[{"Tile", "[", RowBox[{"[", "g", "]"}], "]"}]}], ")"}], ",", "n"}], "]"}], "\[Union]", RowBox[{"{", "}"}]}], "==", RowBox[{"Tile", "[", RowBox[{"[", "g", "]"}], "]"}]}], ",", RowBox[{ RowBox[{ RowBox[{"Tile", "[", RowBox[{"[", "g", "]"}], "]"}], "=", "0"}], ";", RowBox[{ RowBox[{"maxperiod", "[", RowBox[{"[", RowBox[{"jj", ",", "g"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"Divisors", "[", "n", "]"}], "[", RowBox[{"[", "ff", "]"}], "]"}]}], ";", RowBox[{"ff", "=", "0"}], ";"}]}], "\[IndentingNewLine]", " ", "]"}], ";", "\[IndentingNewLine]", RowBox[{"ff", "=", RowBox[{"ff", "-", "1"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", " ", RowBox[{"g", "=", RowBox[{"g", "+", "1"}]}], ";", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}]}], ";", RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "1"}], ";", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{"n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{"i", "=", RowBox[{"i", "-", "1"}]}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", " ", RowBox[{"j", "\[LessEqual]", "n"}], ",", RowBox[{ RowBox[{"k", "=", "100"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Not", "[", RowBox[{"MemberQ", "[", RowBox[{ RowBox[{"U", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"Mod", "[", RowBox[{"j", ",", "n"}], "]"}]}], "]"}], "]"}], ",", " ", RowBox[{ RowBox[{"k", "=", "0"}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"m", "=", "1"}], ",", " ", RowBox[{"m", "\[LessEqual]", RowBox[{"Length", "[", "B", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"U", "[", RowBox[{"[", "i", "]"}], "]"}], "\[Intersection]", " ", RowBox[{"Mod", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"j", "-", RowBox[{"B", "[", RowBox[{"[", "m", "]"}], "]"}]}], ")"}], "+", "B"}], ",", "n"}], "]"}]}], "\[Equal]", RowBox[{"{", "}"}]}], ",", " ", RowBox[{ RowBox[{"k", "=", RowBox[{"k", "+", "1"}]}], ";", " ", RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", "j", ",", "m"}], "]"}], "]"}], "=", RowBox[{"Mod", "[", RowBox[{ RowBox[{"j", "-", RowBox[{"B", "[", RowBox[{"[", "m", "]"}], "]"}]}], ",", "n"}], "]"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"m", "++"}]}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"R", "[", RowBox[{"[", "j", "]"}], "]"}], "=", "k"}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"min", "=", RowBox[{"Min", "[", "R", "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"(", RowBox[{"Not", "[", RowBox[{"min", "\[Equal]", "0"}], "]"}], ")"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"Catch", "[", RowBox[{"Do", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"R", "[", RowBox[{"[", "ii", "]"}], "]"}], "\[Equal]", "min"}], ",", " ", RowBox[{"Throw", "[", "ii", "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"ii", ",", "n"}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "\[LessEqual]", RowBox[{"Length", "[", "B", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"b", "=", RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", " ", RowBox[{"b", "<=", RowBox[{"Length", "[", "B", "]"}]}], ",", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"b", "+", "1"}]}], ";", RowBox[{"z", "=", "0"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Not", "[", RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", "t", ",", "b"}], "]"}], "]"}], "\[Equal]", "200"}], "]"}], ",", " ", RowBox[{ RowBox[{ RowBox[{"U", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"U", "[", RowBox[{"[", "i", "]"}], "]"}], "\[Union]", RowBox[{"Mod", "[", RowBox[{ RowBox[{ RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", "t", ",", "b"}], "]"}], "]"}], "+", "B"}], ",", "n"}], "]"}]}]}], ";", " ", RowBox[{ RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "\[Union]", RowBox[{"{", RowBox[{"A", "[", RowBox[{"[", RowBox[{"i", ",", "t", ",", "b"}], "]"}], "]"}], "}"}]}]}], ";", " ", RowBox[{"b", "=", RowBox[{ RowBox[{"Length", "[", "B", "]"}], "+", "1"}]}], ";", RowBox[{"z", "=", "1"}], ";", RowBox[{"i", "=", RowBox[{"i", "+", "1"}]}], ";"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"b", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"z", "==", "0"}], ",", " ", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "1"}], ";", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{"n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{"i", "=", RowBox[{"i", "-", "1"}]}]}]}], "]"}], ";"}], "\[IndentingNewLine]", ",", " ", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "1"}], ";", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{"n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}]}], ";", RowBox[{"i", "=", RowBox[{"i", "-", "1"}]}]}]}], "]"}], ";"}], "\[IndentingNewLine]", ",", " ", RowBox[{ RowBox[{ RowBox[{"mark", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "1"}], ";", RowBox[{ RowBox[{"A", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"200", "&"}], ",", RowBox[{"{", RowBox[{"n", ",", RowBox[{"Length", "[", "B", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{ RowBox[{"T", "[", RowBox[{"[", "i", "]"}], "]"}], "=", RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", "-", "1"}], "]"}], "]"}]}], ";", RowBox[{"i", "=", RowBox[{"i", "-", "1"}]}]}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Tile", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Tile", "\[Union]", RowBox[{"{", "0", "}"}]}], ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"Length", "[", "Tile", "]"}], "\[IndentingNewLine]", "Tile"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", " ", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "Tile", "]"}]}], ",", " ", RowBox[{ RowBox[{"P", "=", RowBox[{"Tile", "[", RowBox[{"[", "j", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "2"}], ",", " ", RowBox[{"i", "<=", RowBox[{"Length", "[", "P", "]"}]}], ",", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"MemberQ", "[", RowBox[{"Tile", ",", RowBox[{ RowBox[{"Mod", "[", RowBox[{ RowBox[{"P", "-", RowBox[{"P", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", "n"}], "]"}], "\[Union]", RowBox[{"{", "}"}]}]}], "]"}], ",", " ", RowBox[{ RowBox[{ RowBox[{"Tile", "[", RowBox[{"[", "j", "]"}], "]"}], "=", "0"}], ";", RowBox[{"i", "=", RowBox[{ RowBox[{"Length", "[", "P", "]"}], "+", "1"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"i", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";", " ", "\[IndentingNewLine]", RowBox[{"Tile", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Tile", "\[Union]", RowBox[{"{", "0", "}"}]}], ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"Not", "[", RowBox[{ RowBox[{"Length", "[", "Tile", "]"}], "\[Equal]", "0"}], "]"}], ",", " ", RowBox[{"rr", "=", RowBox[{"rr", "+", "1"}]}]}], "]"}], ";", "\[IndentingNewLine]", "Tile", ";", "\[IndentingNewLine]", RowBox[{"jj", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "rr", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "maxperiod", "]"}]}], ",", RowBox[{ RowBox[{ RowBox[{"maxperiod", "[", RowBox[{"[", "j", "]"}], "]"}], "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{ RowBox[{"maxperiod", "[", RowBox[{"[", "j", "]"}], "]"}], "\[Union]", RowBox[{"{", "0", "}"}]}], ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "maxperiod", "\[IndentingNewLine]", "\[IndentingNewLine]"}]}]], "Input", CellChangeTimes->{{3.433607074625*^9, 3.4336070753125*^9}, 3.43360775784375*^9, {3.433608176109375*^9, 3.433608222625*^9}, { 3.4336083821875*^9, 3.433608396078125*^9}, {3.433608428078125*^9, 3.4336084434375*^9}, 3.433615226390625*^9, {3.43365296925*^9, 3.433652995109375*^9}}], Cell[BoxData[ DynamicBox[ ToBoxes[{$CellContext`jj, $CellContext`j, $CellContext`i, $CellContext`g, \ $CellContext`mark, $CellContext`rr}, StandardForm], ImageSizeCache->{180.5, {2., 8.}}]], "Output", CellChangeTimes->{3.433607759609375*^9, 3.433653001671875*^9}], Cell[BoxData["1"], "Output", CellChangeTimes->{3.433607759609375*^9, 3.43365300178125*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", "6", "}"}], ",", RowBox[{"{", "2", "}"}]}], "}"}]], "Output", CellChangeTimes->{3.433607759609375*^9, 3.433653001796875*^9}] }, Open ]] }, WindowSize->{1088, 567}, WindowMargins->{{55, Automatic}, {62, Automatic}}, 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[CellGroupData[{ Cell[590, 23, 770, 21, 152, "Input"], Cell[1363, 46, 296, 8, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[1696, 59, 15482, 388, 1292, "Input"], Cell[17181, 449, 194, 4, 30, "Output"], Cell[17378, 455, 946, 15, 50, "Output"], Cell[18327, 472, 68, 1, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[18432, 478, 3123, 76, 372, "Input"], Cell[21558, 556, 70, 1, 30, "Output"], Cell[21631, 559, 338, 11, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[22006, 575, 15109, 401, 2132, "Input"], Cell[37118, 978, 216, 5, 30, "Output"], Cell[37337, 985, 70, 1, 30, "Output"], Cell[37410, 988, 70, 1, 30, "Output"], Cell[37483, 991, 215, 7, 30, "Output"], Cell[37701, 1000, 190, 6, 30, "Output"], Cell[37894, 1008, 490, 13, 30, "Output"] }, Open ]], Cell[38399, 1024, 348, 8, 72, "Input"], Cell[CellGroupData[{ Cell[38772, 1036, 23825, 594, 1652, "Input"], Cell[62600, 1632, 269, 5, 30, "Output"], Cell[62872, 1639, 91, 1, 30, "Output"], Cell[62966, 1642, 185, 5, 30, "Output"] }, Open ]] } ] *) (* End of internal cache information *)