(* 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[ 4892, 143] NotebookOptionsPosition[ 4499, 125] NotebookOutlinePosition[ 4838, 140] CellTagsIndexPosition[ 4795, 137] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Alphabet", "=", RowBox[{"CharacterRange", "[", RowBox[{"\"\\"", ",", "\"\\""}], "]"}]}]], "Input", CellChangeTimes->{{3.410039523943138*^9, 3.410039543911852*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"\<\"A\"\>", ",", "\<\"B\"\>", ",", "\<\"C\"\>", ",", "\<\"D\"\>", ",", "\<\"E\"\>", ",", "\<\"F\"\>", ",", "\<\"G\"\>", ",", "\<\"H\"\>", ",", "\<\"I\"\>", ",", "\<\"J\"\>", ",", "\<\"K\"\>", ",", "\<\"L\"\>", ",", "\<\"M\"\>", ",", "\<\"N\"\>", ",", "\<\"O\"\>", ",", "\<\"P\"\>", ",", "\<\"Q\"\>", ",", "\<\"R\"\>", ",", "\<\"S\"\>", ",", "\<\"T\"\>", ",", "\<\"U\"\>", ",", "\<\"V\"\>", ",", "\<\"W\"\>", ",", "\<\"X\"\>", ",", "\<\"Y\"\>", ",", "\<\"Z\"\>"}], "}"}]], "Output", CellChangeTimes->{3.410039544692975*^9, 3.4100912066413913`*^9}] }, Open ]], Cell[BoxData[""], "Input", CellChangeTimes->{{3.4100395376929097`*^9, 3.410039538594206*^9}}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"FrequencyCount", "[", RowBox[{"text_", ",", "symbollength_"}], "]"}], ":=", RowBox[{"(", RowBox[{ RowBox[{"SymbolList", "=", RowBox[{"Union", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"StringTake", "[", RowBox[{ RowBox[{"StringJoin", "[", RowBox[{ RowBox[{"Alphabet", "[", RowBox[{"[", RowBox[{ RowBox[{"Mod", "[", RowBox[{"i", ",", RowBox[{"Length", "[", "Alphabet", "]"}]}], "]"}], "+", "1"}], "]"}], "]"}], ",", RowBox[{"Alphabet", "[", RowBox[{"[", RowBox[{ RowBox[{"Mod", "[", RowBox[{ RowBox[{"Floor", "[", RowBox[{"i", "/", RowBox[{"Length", "[", "Alphabet", "]"}]}], "]"}], ",", RowBox[{"Length", "[", "Alphabet", "]"}]}], "]"}], "+", "1"}], "]"}], "]"}], ",", RowBox[{"Alphabet", "[", RowBox[{"[", RowBox[{ RowBox[{"Floor", "[", RowBox[{"i", "/", RowBox[{ RowBox[{"Length", "[", "Alphabet", "]"}], "^", "2"}]}], "]"}], "+", "1"}], "]"}], "]"}]}], "]"}], ",", "symbollength"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "0", ",", RowBox[{ RowBox[{ RowBox[{"Length", "[", "Alphabet", "]"}], "^", "3"}], "-", "1"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"FrequencyTable", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"SymbolList", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"N", "[", RowBox[{ RowBox[{"StringCount", "[", RowBox[{"text", ",", RowBox[{"SymbolList", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "/", RowBox[{"(", RowBox[{ RowBox[{"StringLength", "[", "text", "]"}], "-", "symbollength", "+", "1"}], ")"}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "SymbolList", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Sort", "[", RowBox[{"FrequencyTable", ",", RowBox[{ RowBox[{ RowBox[{"#1", "[", RowBox[{"[", "2", "]"}], "]"}], ">", RowBox[{"#2", "[", RowBox[{"[", "2", "]"}], "]"}]}], "&"}]}], "]"}]}], ")"}]}], ";"}]], "Input", CellChangeTimes->{{3.4100389456115384`*^9, 3.41003934507594*^9}, { 3.410039389189372*^9, 3.4100394112611094`*^9}, {3.410039468523449*^9, 3.4100395170131736`*^9}}] }, WindowSize->{615, 559}, 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, 203, 4, 31, "Input"], Cell[796, 29, 611, 9, 30, "Output"] }, Open ]], Cell[1422, 41, 94, 1, 31, "Input"], Cell[1519, 44, 2976, 79, 292, "Input"] } ] *) (* End of internal cache information *)