(* 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[ 75009, 1937] NotebookOptionsPosition[ 74598, 1919] NotebookOutlinePosition[ 74938, 1934] CellTagsIndexPosition[ 74895, 1931] WindowFrame->Normal ContainsDynamic->True *) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ RowBox[{" ", RowBox[{"(*", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"3", ",", "8", ",", "9"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "4", ",", "16"}], "}"}]}], "}"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ "For", " ", "comments", " ", "see", " ", "the", " ", "music349vs2816", " ", "file"}]}], ",", " ", RowBox[{"whihc", " ", "runs", " ", "the", " ", "same", " ", RowBox[{"way", "."}]}]}], "\[IndentingNewLine]", " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"{", RowBox[{"j", ",", "i", ",", "g", ",", " ", "mark"}], "}"}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Clear", "[", RowBox[{ "n", ",", "B", ",", "R", ",", "Tile", ",", "A", ",", "U", ",", "mark", ",", "T", ",", "g", ",", "x"}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"L", "=", RowBox[{"Expand", "[", RowBox[{"Cyclotomic", "[", RowBox[{"8", ",", "x"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", "16"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"B", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"Length", "[", "L", "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "2"}], ",", " ", RowBox[{"j", "\[LessEqual]", RowBox[{"Length", "[", "L", "]"}]}], ",", " ", RowBox[{ RowBox[{ RowBox[{"B", "[", RowBox[{"[", "j", "]"}], "]"}], "=", RowBox[{"Mod", "[", RowBox[{ RowBox[{"L", "[", RowBox[{"[", RowBox[{"j", ",", "2"}], "]"}], "]"}], ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"B", "\[Union]", RowBox[{"{", "}"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Dynamic", "[", RowBox[{"{", RowBox[{"j", ",", "i", ",", "g", ",", " ", "mark"}], "}"}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Clear", "[", RowBox[{ "n", ",", "B", ",", "R", ",", "Tile", ",", "A", ",", "U", ",", "mark", ",", "T", ",", "g", ",", "x"}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", "16"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"B", "=", RowBox[{"{", RowBox[{"0", ",", "4"}], "}"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Length", "[", "B", "]"}], ";"}], "\[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]", "Tile", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Dynamic", "[", RowBox[{"{", RowBox[{"h", ",", "p", ",", "k", ",", "j", ",", "m", ",", "e"}], "}"}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", "144"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"w", "=", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"Exp", "[", RowBox[{"I", " ", "2", " ", RowBox[{"Pi", " ", "/", "6"}]}], "]"}], ",", RowBox[{"Exp", "[", RowBox[{"I", " ", "2", " ", RowBox[{"Pi", " ", "/", "12"}]}], "]"}], ",", RowBox[{"Exp", "[", RowBox[{"I", " ", "2", " ", RowBox[{"Pi", " ", "/", "48"}]}], "]"}], ",", RowBox[{"Exp", "[", RowBox[{"I", " ", "2", " ", RowBox[{"Pi", " ", "/", "18"}]}], "]"}], ",", RowBox[{"Exp", "[", RowBox[{"I", " ", "2", " ", RowBox[{"Pi", " ", "/", "36"}]}], "]"}], ",", RowBox[{"Exp", "[", RowBox[{"I", " ", "2", " ", RowBox[{"Pi", " ", "/", "144"}]}], "]"}], ",", RowBox[{"Exp", "[", RowBox[{"I", " ", "2", " ", RowBox[{"Pi", " ", "/", "24"}]}], "]"}], ",", RowBox[{"Exp", "[", RowBox[{"I", " ", "2", " ", RowBox[{"Pi", " ", "/", "72"}]}], "]"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"log", "=", RowBox[{"{", RowBox[{ "2", ",", "6", ",", "12", ",", "48", ",", "18", ",", "36", ",", "144", ",", "24", ",", "72"}], "}"}]}], ";"}], " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"KK", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "0", ",", "1", ",", "2", ",", "3", ",", "8", ",", "9", ",", "10", ",", "11"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "1", ",", "2", ",", "7", ",", "8", ",", "9", ",", "10", ",", "15"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "1", ",", "3", ",", "6", ",", "8", ",", "9", ",", "11", ",", "14"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "1", ",", "6", ",", "7", ",", "8", ",", "9", ",", "14", ",", "15"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "2", ",", "3", ",", "5", ",", "8", ",", "10", ",", "11", ",", "13"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "2", ",", "5", ",", "7", ",", "8", ",", "10", ",", "13", ",", "15"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "3", ",", "5", ",", "6", ",", "8", ",", "11", ",", "13", ",", "14"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "5", ",", "6", ",", "7", ",", "8", ",", "13", ",", "14", ",", "15"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"TILE", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"1", "&"}], ",", "100000"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Tilea", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", "60000"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Tileb", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"{", RowBox[{"60000", ",", "10"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"h", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"e", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"p", "=", "1"}], ",", RowBox[{"p", "\[LessEqual]", RowBox[{"Length", "[", "KK", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"k", "=", "0"}], ",", RowBox[{"k", "\[LessEqual]", "8"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "0"}], ",", " ", RowBox[{"j", "\[LessEqual]", "8"}], ",", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"p", ">", "1"}], ")"}], "\[Or]", RowBox[{"(", RowBox[{"j", ">", "0"}], ")"}], "\[Or]", RowBox[{"(", RowBox[{"k", ">", "0"}], ")"}]}], " ", ",", RowBox[{ RowBox[{"Tilec", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Tileb", "\[Union]", RowBox[{"{", "}"}]}], ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"d", "=", "1"}], ",", RowBox[{"d", "\[LessEqual]", RowBox[{"Length", "[", "Tilec", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"TILE", "[", RowBox[{"[", "e", "]"}], "]"}], "=", RowBox[{"Catch", "[", RowBox[{"Do", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Tileb", "[", RowBox[{"[", "ii", "]"}], "]"}], "\[Equal]", RowBox[{"Tilec", "[", RowBox[{"[", "d", "]"}], "]"}]}], ",", " ", RowBox[{"Throw", "[", RowBox[{"Tilea", "[", RowBox[{"[", "ii", "]"}], "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"ii", ",", RowBox[{"Length", "[", "Tileb", "]"}]}], "}"}]}], "]"}], "]"}]}], ";", RowBox[{"e", "=", RowBox[{"e", "+", "1"}]}], ";", "\[IndentingNewLine]", RowBox[{"d", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", " ", RowBox[{"h", "=", "1"}], ";", RowBox[{"Tilea", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", "60000"}], "]"}]}], ";", RowBox[{"Tileb", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"{", RowBox[{"60000", ",", "8"}], "}"}]}], "]"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"m", "=", "0"}], ",", RowBox[{"m", "\[LessEqual]", "8"}], ",", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m2", "=", "0"}], ",", RowBox[{"m2", "\[LessEqual]", "8"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m3", "=", "0"}], ",", RowBox[{"m3", "\[LessEqual]", "8"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m4", "=", "0"}], ",", RowBox[{"m4", "\[LessEqual]", "8"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"m5", "=", "0"}], ",", RowBox[{"m5", "\[LessEqual]", "8"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Tilea", "[", RowBox[{"[", "h", "]"}], "]"}], "=", RowBox[{ RowBox[{"{", RowBox[{"0", ",", RowBox[{ RowBox[{"16", "k"}], "+", RowBox[{"KK", "[", RowBox[{"[", RowBox[{"p", ",", "2"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"16", "j"}], "+", RowBox[{"KK", "[", RowBox[{"[", RowBox[{"p", ",", "3"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"16", "m"}], "+", RowBox[{"KK", "[", RowBox[{"[", RowBox[{"p", ",", "4"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"16", "m2"}], "+", RowBox[{"KK", "[", RowBox[{"[", RowBox[{"p", ",", "5"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"16", "m3"}], "+", RowBox[{"KK", "[", RowBox[{"[", RowBox[{"p", ",", "6"}], "]"}], "]"}]}], ",", " ", RowBox[{ RowBox[{"16", "m4"}], "+", RowBox[{"KK", "[", RowBox[{"[", RowBox[{"p", ",", "7"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"16", "m5"}], "+", RowBox[{"KK", "[", RowBox[{"[", RowBox[{"p", ",", "8"}], "]"}], "]"}]}]}], " ", "}"}], "\[Union]", RowBox[{"{", "}"}]}]}], ";", RowBox[{"P", "=", RowBox[{"Tilea", "[", RowBox[{"[", "h", "]"}], "]"}]}], ";", " ", RowBox[{"MAX", "=", RowBox[{"Max", "[", RowBox[{ RowBox[{"P", "[", RowBox[{"[", "2", "]"}], "]"}], ",", " ", RowBox[{ RowBox[{"P", "[", RowBox[{"[", "3", "]"}], "]"}], "-", RowBox[{"P", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{ RowBox[{"P", "[", RowBox[{"[", "4", "]"}], "]"}], "-", RowBox[{"P", "[", RowBox[{"[", "3", "]"}], "]"}]}], ",", RowBox[{ RowBox[{"P", "[", RowBox[{"[", "5", "]"}], "]"}], "-", RowBox[{"P", "[", RowBox[{"[", "4", "]"}], "]"}]}], ",", RowBox[{ RowBox[{"P", "[", RowBox[{"[", "6", "]"}], "]"}], "-", RowBox[{"P", "[", RowBox[{"[", "5", "]"}], "]"}]}], ",", RowBox[{ RowBox[{"P", "[", RowBox[{"[", "7", "]"}], "]"}], "-", RowBox[{"P", "[", RowBox[{"[", "6", "]"}], "]"}]}], ",", RowBox[{ RowBox[{"P", "[", RowBox[{"[", "8", "]"}], "]"}], "-", RowBox[{"P", "[", RowBox[{"[", "7", "]"}], "]"}]}], ",", RowBox[{"144", "-", RowBox[{"P", "[", RowBox[{"[", "8", "]"}], "]"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"MAX", "\[Equal]", RowBox[{"P", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", "9"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"1", "+", RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], "^", RowBox[{"P", "[", RowBox[{"[", "2", "]"}], "]"}]}], "+", RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], "^", RowBox[{"P", "[", RowBox[{"[", "3", "]"}], "]"}]}], "+", RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], "^", RowBox[{"P", "[", RowBox[{"[", "4", "]"}], "]"}]}], "+", RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], "^", RowBox[{"P", "[", RowBox[{"[", "5", "]"}], "]"}]}], "+", RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], "^", RowBox[{"P", "[", RowBox[{"[", "6", "]"}], "]"}]}], "+", RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], "^", RowBox[{"P", "[", RowBox[{"[", "7", "]"}], "]"}]}], "+", RowBox[{ RowBox[{"w", "[", RowBox[{"[", "i", "]"}], "]"}], "^", RowBox[{"P", "[", RowBox[{"[", "8", "]"}], "]"}]}]}], "\[Equal]", "0"}], ",", " ", RowBox[{ RowBox[{"Tileb", "[", RowBox[{"[", RowBox[{"h", ",", "i"}], "]"}], "]"}], "=", RowBox[{"log", "[", RowBox[{"[", "i", "]"}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"i", "++"}]}]}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"Tileb", "[", RowBox[{"[", "h", "]"}], "]"}], "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{ RowBox[{"Tileb", "[", RowBox[{"[", "h", "]"}], "]"}], "\[Union]", RowBox[{"{", "}"}]}], ",", "1"}], "]"}]}], ";", RowBox[{"h", "=", RowBox[{"h", "+", "1"}]}], ";", "\[IndentingNewLine]", RowBox[{"m5", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"m4", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"m3", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"m2", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"m", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"k", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"p", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Tilea", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Tilea", "\[Union]", RowBox[{"{", "0", "}"}]}], ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Length", "[", "Tilea", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"TILE", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"TILE", "\[Union]", RowBox[{"{", "0", "}"}]}], ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Length", "[", "TILE", "]"}], "\[IndentingNewLine]", RowBox[{"TILE", ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"TILE", "=", RowBox[{"Drop", "[", RowBox[{"TILE", ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Length", "[", "TILE", "]"}], "\[IndentingNewLine]", 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[{"{", "0", "}"}]}], ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Length", "[", "TILE", "]"}], "\[IndentingNewLine]", RowBox[{"TILE", ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Dynamic", "[", RowBox[{"{", RowBox[{"j", ",", "v", ",", "vvv", ",", "vvvv"}], "}"}], "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"T2", "=", "TILE"}], ";"}], "\[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", "]"}], ",", "144"}], "}"}]}], "]"}]}], ";"}], "\[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]", "144"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"MemberQ", "[", RowBox[{ RowBox[{"T2", "[", RowBox[{"[", "j", "]"}], "]"}], ",", RowBox[{"Mod", "[", RowBox[{"k", ",", "144"}], "]"}]}], "]"}], ",", 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]", "144"}], ",", "\[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", "=", "145"}], ";", RowBox[{"cont", "=", RowBox[{"cont", "+", "1"}]}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"k", "++"}]}]}], "]"}], ";", "\[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[{"MT", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"MT", "\[Union]", RowBox[{"{", "}"}]}], ",", "1"}], "]"}]}], "\[IndentingNewLine]", RowBox[{"MF", "=", RowBox[{"Drop", "[", RowBox[{ RowBox[{"MF", "\[Union]", RowBox[{"{", "}"}]}], ",", "1"}], "]"}]}], "\[IndentingNewLine]", RowBox[{"Length", "[", "MF", "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"J", "=", "MF"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"F1", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"1", "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Length", "[", "J", "]"}], ",", "144"}], "}"}]}], "]"}]}], ";"}], "\[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]", "144"}], ",", "\[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]", "\[IndentingNewLine]", RowBox[{"F1", ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"FF1", "=", RowBox[{"Array", "[", RowBox[{ RowBox[{"0", "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Length", "[", "F1", "]"}], ",", "144"}], "}"}]}], "]"}]}], ";"}], "\[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]", "144"}], ",", "\[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]", 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"}], "]"}], "]"}], ",", "144"}], "]"}]}], ";", "\[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]", "FF", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"FT", "=", RowBox[{"144", "/", "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", "[", "144", "]"}], ",", RowBox[{"FT", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"j", "++"}]}]}], "]"}], ";"}], "\[IndentingNewLine]", "CFT", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 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", ",", "19", ",", "38", ",", "56", ",", "73", ",", "91", ",", "110", ",", "129"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "21", ",", "39", ",", "58", ",", "72", ",", "93", ",", "114", ",", "127"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "21", ",", "40", ",", "51", ",", "70", ",", "91", ",", "109", ",", "126"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "21", ",", "40", ",", "58", ",", "77", ",", "95", ",", "114", ",", "135"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "22", ",", "40", ",", "55", ",", "73", ",", "95", ",", "113", ",", "126"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "22", ",", "40", ",", "57", ",", "75", ",", "97", ",", "115", ",", "126"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "22", ",", "40", ",", "62", ",", "81", ",", "103", ",", "121", ",", "143"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "23", ",", "41", ",", "63", ",", "81", ",", "86", ",", "104", ",", "126"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "24", ",", "26", ",", "50", ",", "55", ",", "79", ",", "101", ",", "125"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "24", ",", "26", ",", "50", ",", "71", ",", "95", ",", "105", ",", "129"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "24", ",", "29", ",", "53", ",", "66", ",", "90", ",", "107", ",", "131"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "24", ",", "30", ",", "54", ",", "57", ",", "81", ",", "99", ",", "123"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "24", ",", "33", ",", "54", ",", "57", ",", "78", ",", "99", ",", "123"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "24", ",", "35", ",", "59", ",", "81", ",", "98", ",", "105", ",", "122"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "24", ",", "45", ",", "69", ",", "90", ",", "99", ",", "114", ",", "123"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "24", ",", "47", ",", "54", ",", "71", ",", "78", ",", "101", ",", "125"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "27", ",", "38", ",", "65", ",", "78", ",", "104", ",", "105", ",", "131"}], "}"}], ",", RowBox[{"{", RowBox[{ "0", ",", "27", ",", "51", ",", "54", ",", "72", ",", "81", ",", "105", ",", "126"}], "}"}]}], "}"}]}], ";"}], "\[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]", "\[IndentingNewLine]", "\[IndentingNewLine]"}]}]], "Input", CellChangeTimes->{{3.431764455078125*^9, 3.43176448128125*^9}, { 3.432188000078125*^9, 3.432188013890625*^9}, {3.43218807965625*^9, 3.432188091890625*^9}, {3.43218813903125*^9, 3.43218814059375*^9}, { 3.432188204640625*^9, 3.432188282671875*^9}, {3.432188402375*^9, 3.43218846765625*^9}, {3.432188596828125*^9, 3.432188622125*^9}, { 3.43218865578125*^9, 3.432188747515625*^9}, {3.43365840034375*^9, 3.433658408640625*^9}, {3.433660182546875*^9, 3.43366021903125*^9}, { 3.43366570484375*^9, 3.43366571309375*^9}, {3.433665754203125*^9, 3.43366578071875*^9}, {3.433665851296875*^9, 3.43366586*^9}}], Cell[BoxData[ DynamicBox[ ToBoxes[{$CellContext`jj, $CellContext`j, $CellContext`i, $CellContext`g, \ $CellContext`mark, $CellContext`rr}, StandardForm], ImageSizeCache->{249.0625, {2., 8.}}]], "Output", CellChangeTimes->{3.43366558775*^9}], Cell[BoxData["1"], "Output", CellChangeTimes->{3.4336656888125*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "16", "}"}], ",", RowBox[{"{", "16", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "16", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "48", "}"}], ",", RowBox[{"{", "16", "}"}]}], "}"}]], "Output", CellChangeTimes->{3.433665688875*^9}] }, Open ]] }, WindowSize->{1011, 567}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, 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, 72947, 1860, 6012, "Input"], Cell[73540, 1885, 246, 5, 30, "Output"], Cell[73789, 1892, 68, 1, 30, "Output"], Cell[73860, 1895, 722, 21, 30, "Output"] }, Open ]] } ] *) (* End of internal cache information *)