(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 18460, 538] NotebookOptionsPosition[ 17358, 497] NotebookOutlinePosition[ 17725, 513] CellTagsIndexPosition[ 17682, 510] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ StyleBox[ RowBox[{"How", " ", "many", " ", "distinct", " ", "prime", " ", RowBox[{"factors", "?"}]}], "Subtitle"]], "Input", CellChangeTimes->{{3.463699480484375*^9, 3.463699490484375*^9}, { 3.4637560361230717`*^9, 3.4637560425015697`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{ "number", " ", "=", " ", "5487525252462375652364513298043621345687"}], ";"}]], "Input", CellChangeTimes->{{3.463698653921875*^9, 3.463698659828125*^9}, { 3.463699072875*^9, 3.463699079640625*^9}, {3.46369916290625*^9, 3.4636992610625*^9}, {3.46369936909375*^9, 3.463699369296875*^9}, { 3.463699424734375*^9, 3.46369943346875*^9}, {3.463756083652256*^9, 3.4637560838543916`*^9}, {3.46382873565625*^9, 3.463828738796875*^9}, { 3.46382876971875*^9, 3.463828769984375*^9}, 3.463829167515625*^9}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"findingprimefactors", "[", RowBox[{"numb_", ",", "option_"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"temp", " ", "=", " ", RowBox[{"FactorInteger", "[", "numb", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"numfactors", " ", "=", " ", RowBox[{"Length", "[", "temp", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"option", " ", "\[Equal]", " ", "1"}], ",", "\[IndentingNewLine]", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", " ", "numb", ",", " ", "\"\<.\>\""}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", " ", "numfactors", ",", " ", "\"\<.\>\""}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", " ", RowBox[{"1.0", " ", RowBox[{"Log", "[", " ", RowBox[{"Log", "[", "numb", "]"}], "]"}]}], ",", " ", "\"\<.\>\""}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", "temp", ",", " ", "\"\<.\>\""}], "]"}], ";"}], "\[IndentingNewLine]", "}"}], ",", " ", RowBox[{"Return", "[", "numfactors", "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.4636986674375*^9, 3.463698833484375*^9}, 3.463698904078125*^9, {3.463698940796875*^9, 3.463699043484375*^9}, { 3.463699129125*^9, 3.463699152296875*^9}, {3.463699265109375*^9, 3.4636992888125*^9}, {3.46369935540625*^9, 3.463699364140625*^9}, { 3.4636994140625*^9, 3.463699416125*^9}, {3.46370101915625*^9, 3.46370106009375*^9}, {3.46370120903125*^9, 3.463701211921875*^9}, { 3.4637559015369587`*^9, 3.463756026362954*^9}, {3.4637560685858374`*^9, 3.463756069614092*^9}, {3.4637562422954226`*^9, 3.46375626187913*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"findingprimefactors", "[", RowBox[{"number", " ", ",", "1"}], "]"}]], "Input", CellChangeTimes->{{3.463698977828125*^9, 3.46369899046875*^9}, { 3.46369907525*^9, 3.463699075796875*^9}, {3.463700744625*^9, 3.463700748203125*^9}, {3.46370097209375*^9, 3.463700986375*^9}, { 3.46370106609375*^9, 3.46370106696875*^9}, {3.463756046058959*^9, 3.4637560579790945`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Number is \"\>", "\[InvisibleSpace]", "5487525252462375652364513298043621345687", "\[InvisibleSpace]", "\<\".\"\>"}], SequenceForm["Number is ", 5487525252462375652364513298043621345687, "."], Editable->False]], "Print", CellChangeTimes->{ 3.463828778515625*^9, 3.46382916984375*^9, {3.464037016453125*^9, 3.464037019859375*^9}}], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Number of prime factors is \"\>", "\[InvisibleSpace]", "5", "\[InvisibleSpace]", "\<\".\"\>"}], SequenceForm["Number of prime factors is ", 5, "."], Editable->False]], "Print", CellChangeTimes->{ 3.463828778515625*^9, 3.46382916984375*^9, {3.464037016453125*^9, 3.464037019875*^9}}], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Expected number of prime factors is \"\>", "\[InvisibleSpace]", "4.516374993566843`", "\[InvisibleSpace]", "\<\".\"\>"}], SequenceForm["Expected number of prime factors is ", 4.516374993566843, "."], Editable->False]], "Print", CellChangeTimes->{ 3.463828778515625*^9, 3.46382916984375*^9, {3.464037016453125*^9, 3.464037019875*^9}}], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Prime factorization is \"\>", "\[InvisibleSpace]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"7", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"11", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"6619", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"101399", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"9653105849003586101891476541", ",", "1"}], "}"}]}], "}"}], "\[InvisibleSpace]", "\<\".\"\>"}], SequenceForm[ "Prime factorization is ", {{7, 1}, {11, 2}, {6619, 1}, {101399, 1}, { 9653105849003586101891476541, 1}}, "."], Editable->False]], "Print", CellChangeTimes->{ 3.463828778515625*^9, 3.46382916984375*^9, {3.464037016453125*^9, 3.464037019875*^9}}] }, Open ]] }, Open ]], Cell[BoxData[""], "Input", CellChangeTimes->{{3.463700945859375*^9, 3.463700946265625*^9}}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"histogramfactors", "[", RowBox[{"start_", ",", "numdo_"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"output", " ", "=", " ", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"n", " ", "=", " ", "1"}], ",", " ", RowBox[{"n", " ", "\[LessEqual]", " ", "numdo"}], ",", " ", RowBox[{"n", "++"}], ",", " ", RowBox[{"output", " ", "=", " ", RowBox[{"AppendTo", "[", RowBox[{"output", ",", " ", RowBox[{"findingprimefactors", "[", " ", RowBox[{ RowBox[{"start", " ", "+", " ", "n"}], ",", "0"}], "]"}]}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"Histogram", "[", RowBox[{"output", ",", "Automatic", ",", " ", "\"\\""}], "]"}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.46370094878125*^9, 3.46370095934375*^9}, { 3.463700990890625*^9, 3.46370100815625*^9}, {3.463701076046875*^9, 3.463701097515625*^9}, {3.46370122646875*^9, 3.4637012760625*^9}, { 3.46370139040625*^9, 3.46370141709375*^9}, {3.463701501109375*^9, 3.4637015055625*^9}, {3.46375610081522*^9, 3.463756143872034*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Timing", "[", RowBox[{"histogramfactors", "[", RowBox[{ "5487525252462375634352364513298043621345687989991218989811", ",", "1000"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.4637007899375*^9, 3.463700811578125*^9}, { 3.46370089390625*^9, 3.4637008973125*^9}, {3.463700928890625*^9, 3.4637009304375*^9}, {3.463701280078125*^9, 3.463701305578125*^9}, { 3.463701356*^9, 3.463701361828125*^9}, {3.463701426515625*^9, 3.463701462109375*^9}, {3.463701547046875*^9, 3.463701547203125*^9}, { 3.4637561543440204`*^9, 3.4637561880313177`*^9}, {3.4637563010045557`*^9, 3.463756324714952*^9}, {3.46382879690625*^9, 3.463828798203125*^9}, { 3.463829186265625*^9, 3.463829192375*^9}, {3.464037100796875*^9, 3.464037170703125*^9}}], Cell[BoxData[ GraphicsBox[ {RGBColor[0.798413061722744, 0.824719615472648, 0.968322270542458], EdgeForm[Opacity[0.7]], {}, {RGBColor[0.798413061722744, 0.824719615472648, 0.968322270542458], EdgeForm[Opacity[0.7]], {}, TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{1, 0}, {2, 0.008}]}, ImageSizeCache->{{48.33367346938776, 76.41734693877551}, { 90.55016938191983, 97.68819151024776}}], StatusArea[#, 0.008]& , TagBoxNote->"0.008"], StyleBox["0.008`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.008, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{2, 0}, {3, 0.045}]}, ImageSizeCache->{{75.91734693877551, 104.00102040816327`}, { 59.849317038403164`, 97.68819151024776}}], StatusArea[#, 0.045]& , TagBoxNote->"0.045"], StyleBox["0.045`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.045, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{3, 0}, {4, 0.133}]}, ImageSizeCache->{{103.50102040816327`, 131.58469387755102`}, {-13.168926373204059`, 97.68819151024776}}], StatusArea[#, 0.133]& , TagBoxNote->"0.133"], StyleBox["0.133`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.133, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{4, 0}, {5, 0.171}]}, ImageSizeCache->{{131.08469387755102`, 159.16836734693877`}, {-44.699531482761714`, 97.68819151024776}}], StatusArea[#, 0.171]& , TagBoxNote->"0.171"], StyleBox["0.171`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.171, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{5, 0}, {6, 0.226}]}, ImageSizeCache->{{158.66836734693877`, 186.75204081632654`}, {-90.33593361501623, 97.68819151024776}}], StatusArea[#, 0.226]& , TagBoxNote->"0.226"], StyleBox["0.226`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.226, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{6, 0}, {7, 0.195}]}, ImageSizeCache->{{186.25204081632654`, 214.3357142857143}, {-64.6135978677455, 97.68819151024776}}], StatusArea[#, 0.195]& , TagBoxNote->"0.195"], StyleBox["0.195`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.195, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{7, 0}, {8, 0.139}]}, ImageSizeCache->{{213.8357142857143, 241.91938775510204`}, {-18.14744296945001, 97.68819151024776}}], StatusArea[#, 0.139]& , TagBoxNote->"0.139"], StyleBox["0.139`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.139, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{8, 0}, {9, 0.044}]}, ImageSizeCache->{{241.41938775510204`, 269.5030612244898}, { 60.679069804444154`, 97.68819151024776}}], StatusArea[#, 0.044]& , TagBoxNote->"0.044"], StyleBox["0.044`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.044, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{9, 0}, {10, 0.024}]}, ImageSizeCache->{{269.0030612244898, 297.08673469387753`}, { 77.27412512526398, 97.68819151024776}}], StatusArea[#, 0.024]& , TagBoxNote->"0.024"], StyleBox["0.024`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.024, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{10, 0}, {11, 0.013}]}, ImageSizeCache->{{296.58673469387753`, 324.6704081632653}, { 86.40140555171487, 97.68819151024776}}], StatusArea[#, 0.013]& , TagBoxNote->"0.013"], StyleBox["0.013`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.013, { GrayLevel[0]}], "Tooltip"]& ], TagBox[ TooltipBox[ TagBox[ DynamicBox[{ FEPrivate`If[ CurrentValue["MouseOver"], EdgeForm[{ GrayLevel[0.5], AbsoluteThickness[1.5], Opacity[0.66]}], {}, {}], RectangleBox[{11, 0}, {12, 0.002}]}, ImageSizeCache->{{324.1704081632653, 352.2540816326531}, { 95.52868597816578, 97.68819151024776}}], StatusArea[#, 0.002]& , TagBoxNote->"0.002"], StyleBox["0.002`", { GrayLevel[0]}, StripOnInput -> False]], Annotation[#, Style[0.002, { GrayLevel[0]}], "Tooltip"]& ]}, {}, {}}, AspectRatio->NCache[GoldenRatio^(-1), 0.6180339887498948], Axes->{True, True}, AxesOrigin->{0, 0}, FrameTicks->{{Automatic, Automatic}, {Automatic, Automatic}}, PlotRange->{{0, 12}, {All, All}}, PlotRangePadding->{{ Scaled[0.02], Scaled[0.02]}, { Scaled[0.02], Scaled[0.1]}}, Ticks->{Automatic, Automatic}]], "Print", CellChangeTimes->{{3.463829189921875*^9, 3.46382919878125*^9}, 3.4640370423125*^9, {3.464037109953125*^9, 3.46403716603125*^9}, 3.464041853484375*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{"4273.36`", ",", "Null"}], "}"}]], "Output", CellChangeTimes->{{3.46403711815625*^9, 3.46403716603125*^9}, 3.464041853484375*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"4273", "/", "60."}]], "Input", CellChangeTimes->{{3.46404239834375*^9, 3.46404240409375*^9}}], Cell[BoxData["71.21666666666667`"], "Output", CellChangeTimes->{3.464042404609375*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Log", "[", "5487525252462375634352364513298043621345687989991218989811.", "]"}]], "Input", CellChangeTimes->{{3.464044090171875*^9, 3.464044107625*^9}}], Cell[BoxData["132.\ 9498276808667724924228964505685158271377543592207661199914858554588`59.\ 86306431055817"], "Output", CellChangeTimes->{{3.464044096828125*^9, 3.464044108125*^9}}] }, Open ]], Cell[BoxData[{ RowBox[{"n", " ", "=", " ", "10"}], "\[IndentingNewLine]", RowBox[{"m", " ", "=", " ", "10"}], "\[IndentingNewLine]", RowBox[{"p", " ", "=", " ", RowBox[{"1", "/", "2"}]}], "\[IndentingNewLine]", RowBox[{"n", " ", RowBox[{"(", RowBox[{"1", "/", "2"}], ")"}]}]}], "Input", CellChangeTimes->{{3.46557861871875*^9, 3.46557863053125*^9}}] }, WindowSize->{616, 861}, WindowMargins->{{103, Automatic}, {Automatic, 18}}, ShowSelection->True, FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (February 18, 2009)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[545, 20, 264, 5, 44, "Input"], Cell[812, 27, 549, 10, 31, "Input"], Cell[1364, 39, 2318, 49, 272, "Input"], Cell[CellGroupData[{ Cell[3707, 92, 401, 7, 31, "Input"], Cell[CellGroupData[{ Cell[4133, 103, 397, 9, 23, "Print"], Cell[4533, 114, 346, 8, 23, "Print"], Cell[4882, 124, 397, 8, 23, "Print"], Cell[5282, 134, 801, 22, 43, "Print"] }, Open ]] }, Open ]], Cell[6110, 160, 92, 1, 31, "Input"], Cell[6205, 163, 1436, 32, 132, "Input"], Cell[CellGroupData[{ Cell[7666, 199, 780, 14, 72, "Input"], Cell[8449, 215, 7696, 239, 237, "Print"], Cell[16148, 456, 173, 4, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[16358, 465, 118, 2, 31, "Input"], Cell[16479, 469, 87, 1, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[16603, 475, 183, 4, 31, "Input"], Cell[16789, 481, 183, 3, 30, "Output"] }, Open ]], Cell[16987, 487, 367, 8, 92, "Input"] } ] *) (* End of internal cache information *)