(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 9.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 157, 7] NotebookDataLength[ 18267, 703] NotebookOptionsPosition[ 15319, 607] NotebookOutlinePosition[ 15674, 623] CellTagsIndexPosition[ 15631, 620] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Factorial Prime", "Title"], Cell[CellGroupData[{ Cell["Author", "Subsection"], Cell["\<\ Eric W. Weisstein July 26, 2016\ \>", "Text"], Cell[TextData[{ "This notebook downloaded from ", ButtonBox["http://mathworld.wolfram.com/notebooks/PrimeNumbers/\ FactorialPrime.nb", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://mathworld.wolfram.com/notebooks/PrimeNumbers/FactorialPrime.\ nb"], None}], "." }], "Text"], Cell[TextData[{ "For more information, see Eric's ", StyleBox["MathWorld", FontSlant->"Italic"], " entry ", ButtonBox["http://mathworld.wolfram.com/FactorialPrime.html", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://mathworld.wolfram.com/FactorialPrime.html"], None}], "." }], "Text"], Cell["\<\ \[Copyright]2016 Wolfram Research, Inc. except for portions noted otherwise\ \>", "Text"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ Cell[BoxData[ FormBox[ RowBox[{ RowBox[{"n", "!"}], "-", "1"}], TraditionalForm]]], " is Prime" }], "Section"], Cell[TextData[ButtonBox["A002982", BaseStyle->"Hyperlink", ButtonData->{ URL["https://oeis.org/A002982"], None}, ButtonNote->"https://oeis.org/A002982"]], "Text"], Cell["\<\ http://www.primegrid.com/primes/primes.php?project=FPS&factors=+&only=ALL&\ announcements=ALL\ \>", "Text"], Cell["http://prpnet.primegrid.com:12002/user_primes.html", "Text"], Cell["http://prpnet.primegrid.com:12002", "Text"], Cell["http://primes.utm.edu/top20/page.php?id=30", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"l", "=", RowBox[{"{", RowBox[{ "3", ",", "4", ",", "6", ",", "7", ",", "12", ",", "14", ",", "30", ",", "32", ",", "33", ",", "38", ",", "94", ",", "166", ",", "324", ",", "379", ",", "469", ",", "546", ",", "974", ",", "1963", ",", "3507", ",", "3610", ",", "6917", ",", "21480", ",", "34790", ",", "94550", ",", "103040", ",", "147855", ",", "208003"}], "}"}]}], ";"}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"TextGrid", "[", RowBox[{ RowBox[{"MapIndexed", "[", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"#2", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "#", ",", RowBox[{"IntegerLength", "[", RowBox[{ RowBox[{"#", "!"}], "-", "1"}], "]"}]}], "}"}], "&"}], ",", "l"}], "]"}], ",", RowBox[{"Alignment", "\[Rule]", "Decimal"}], ",", RowBox[{"Dividers", "\[Rule]", "All"}]}], "]"}]], "Input"], Cell[BoxData[ TagBox[GridBox[{ {"1", "3", "1"}, {"2", "4", "2"}, {"3", "6", "3"}, {"4", "7", "4"}, {"5", "12", "9"}, {"6", "14", "11"}, {"7", "30", "33"}, {"8", "32", "36"}, {"9", "33", "37"}, {"10", "38", "45"}, {"11", "94", "147"}, {"12", "166", "298"}, {"13", "324", "675"}, {"14", "379", "815"}, {"15", "469", "1051"}, {"16", "546", "1260"}, {"17", "974", "2490"}, {"18", "1963", "5614"}, {"19", "3507", "10912"}, {"20", "3610", "11277"}, {"21", "6917", "23560"}, {"22", "21480", "83727"}, {"23", "34790", "142891"}, {"24", "94550", "429390"}, {"25", "103040", "471794"}, {"26", "147855", "700177"}, {"27", "208003", "1015843"} }, AutoDelete->False, GridBoxAlignment->{"Columns" -> {{Decimal}}, "Rows" -> {{Decimal}}}, GridBoxDividers->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], "TextGrid"]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", RowBox[{"{", RowBox[{"i", ",", RowBox[{"l", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"IntegerLength", "[", RowBox[{ RowBox[{ RowBox[{"l", "[", RowBox[{"[", "i", "]"}], "]"}], "!"}], "-", "1"}], "]"}], ",", RowBox[{ RowBox[{"TimeConstrained", "[", RowBox[{ RowBox[{"PrimeQ", "[", RowBox[{ RowBox[{ RowBox[{"l", "[", RowBox[{"[", "i", "]"}], "]"}], "!"}], "-", "1"}], "]"}], ",", "3600"}], "]"}], "//", "Timing"}]}], "}"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "l", "]"}]}], "}"}]}], "]"}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"{", RowBox[{"1", ",", "3", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"2", ",", "4", ",", RowBox[{"{", RowBox[{ RowBox[{"0.010000000000000009`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"3", ",", "6", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"4", ",", "7", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"5", ",", "12", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"6", ",", "14", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"7", ",", "30", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"8", ",", "32", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"9", ",", "33", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"10", ",", "38", ",", RowBox[{"{", RowBox[{ RowBox[{"0.009999999999999953`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"11", ",", "94", ",", RowBox[{"{", RowBox[{ RowBox[{"0.02999999999999997`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"12", ",", "166", ",", RowBox[{"{", RowBox[{ RowBox[{"0.13`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"13", ",", "324", ",", RowBox[{"{", RowBox[{ RowBox[{"0.32000000000000006`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"14", ",", "379", ",", RowBox[{"{", RowBox[{ RowBox[{"0.5499999999999999`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"15", ",", "469", ",", RowBox[{"{", RowBox[{ RowBox[{"1.0000000000000004`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"16", ",", "546", ",", RowBox[{"{", RowBox[{ RowBox[{"1.62`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"17", ",", "974", ",", RowBox[{"{", RowBox[{ RowBox[{"9.309999999999999`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"18", ",", "1963", ",", RowBox[{"{", RowBox[{ RowBox[{"75.72`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"19", ",", "3507", ",", RowBox[{"{", RowBox[{ RowBox[{"414.07000000000005`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"20", ",", "3610", ",", RowBox[{"{", RowBox[{ RowBox[{"451.45`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"21", ",", "6917", ",", RowBox[{"{", RowBox[{ RowBox[{"2964.1699999999996`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"22", ",", "21480", ",", RowBox[{"{", RowBox[{ RowBox[{"76387.89`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"23", ",", "34790", ",", RowBox[{"{", RowBox[{ RowBox[{"263312.7299999999`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{ FormBox[ RowBox[{ RowBox[{"n", "!"}], "+", "1"}], TraditionalForm], " ", "is", " ", "Prime"}], TraditionalForm]], "Section"], Cell[BoxData[ RowBox[{ RowBox[{"l", "=", RowBox[{"{", RowBox[{ "1", ",", "2", ",", "3", ",", "11", ",", "27", ",", "37", ",", "41", ",", "73", ",", "77", ",", "116", ",", "154", ",", "320", ",", "340", ",", "399", ",", "427", ",", "872", ",", "1477", ",", "6380", ",", "26951", ",", "110059"}], "}"}]}], ";"}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"TextGrid", "[", RowBox[{ RowBox[{"MapIndexed", "[", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"#2", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "#", ",", RowBox[{"IntegerLength", "[", RowBox[{ RowBox[{"#", "!"}], "-", "1"}], "]"}]}], "}"}], "&"}], ",", "l"}], "]"}], ",", RowBox[{"Alignment", "\[Rule]", "Decimal"}], ",", RowBox[{"Dividers", "\[Rule]", "All"}]}], "]"}]], "Input"], Cell[BoxData[ TagBox[GridBox[{ {"1", "1", "0"}, {"2", "2", "1"}, {"3", "3", "1"}, {"4", "11", "8"}, {"5", "27", "29"}, {"6", "37", "44"}, {"7", "41", "50"}, {"8", "73", "106"}, {"9", "77", "114"}, {"10", "116", "191"}, {"11", "154", "272"}, {"12", "320", "665"}, {"13", "340", "715"}, {"14", "399", "867"}, {"15", "427", "940"}, {"16", "872", "2188"}, {"17", "1477", "4042"}, {"18", "6380", "21507"}, {"19", "26951", "107707"}, {"20", "110059", "507082"} }, AutoDelete->False, GridBoxAlignment->{"Columns" -> {{Decimal}}, "Rows" -> {{Decimal}}}, GridBoxDividers->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], "TextGrid"]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", RowBox[{"{", RowBox[{"i", ",", RowBox[{"l", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{ RowBox[{"TimeConstrained", "[", RowBox[{ RowBox[{"PrimeQ", "[", RowBox[{ RowBox[{ RowBox[{"l", "[", RowBox[{"[", "i", "]"}], "]"}], "!"}], "+", "1"}], "]"}], ",", "3600"}], "]"}], "//", "Timing"}]}], "}"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "l", "]"}]}], "}"}]}], "]"}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"{", RowBox[{"1", ",", "1", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"2", ",", "2", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"3", ",", "3", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"4", ",", "11", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"5", ",", "27", ",", RowBox[{"{", RowBox[{ RowBox[{"0.010000000000000009`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"6", ",", "37", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"7", ",", "41", ",", RowBox[{"{", RowBox[{ RowBox[{"0.`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"8", ",", "73", ",", RowBox[{"{", RowBox[{ RowBox[{"0.009999999999999953`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"9", ",", "77", ",", RowBox[{"{", RowBox[{ RowBox[{"0.010000000000000009`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"10", ",", "116", ",", RowBox[{"{", RowBox[{ RowBox[{"0.060000000000000026`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"11", ",", "154", ",", RowBox[{"{", RowBox[{ RowBox[{"0.07999999999999996`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"12", ",", "320", ",", RowBox[{"{", RowBox[{ RowBox[{"0.32999999999999996`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"13", ",", "340", ",", RowBox[{"{", RowBox[{ RowBox[{"0.3900000000000001`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"14", ",", "399", ",", RowBox[{"{", RowBox[{ RowBox[{"0.6199999999999999`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"15", ",", "427", ",", RowBox[{"{", RowBox[{ RowBox[{"0.7400000000000002`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"16", ",", "872", ",", RowBox[{"{", RowBox[{ RowBox[{"6.67`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"17", ",", "1477", ",", RowBox[{"{", RowBox[{ RowBox[{"32.940000000000005`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"18", ",", "6380", ",", RowBox[{"{", RowBox[{ RowBox[{"2407.32`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"], Cell[BoxData[ RowBox[{"{", RowBox[{"19", ",", "26951", ",", RowBox[{"{", RowBox[{ RowBox[{"134708.13999999998`", " ", "Second"}], ",", "True"}], "}"}]}], "}"}]], "Print"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->{946, 809}, WindowMargins->{{255, Automatic}, {68, Automatic}}, FrontEndVersion->"11.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (July 22, \ 2016)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[579, 22, 32, 0, 92, "Title"], Cell[CellGroupData[{ Cell[636, 26, 28, 0, 44, "Subsection"], Cell[667, 28, 55, 3, 49, "Text"], Cell[725, 33, 287, 9, 30, "Text"], Cell[1015, 44, 303, 10, 30, "Text"], Cell[1321, 56, 99, 2, 30, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[1457, 63, 137, 6, 64, "Section"], Cell[1597, 71, 168, 4, 30, "Text"], Cell[1768, 77, 117, 3, 30, "Text"], Cell[1888, 82, 66, 0, 30, "Text"], Cell[1957, 84, 49, 0, 30, "Text"], Cell[2009, 86, 58, 0, 30, "Text"], Cell[2070, 88, 453, 9, 54, "Input"], Cell[CellGroupData[{ Cell[2548, 101, 498, 15, 32, "Input"], Cell[3049, 118, 1007, 34, 534, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4093, 157, 831, 25, 75, "Input"], Cell[CellGroupData[{ Cell[4949, 186, 167, 5, 24, "Print"], Cell[5119, 193, 188, 6, 24, "Print"], Cell[5310, 201, 167, 5, 24, "Print"], Cell[5480, 208, 167, 5, 24, "Print"], Cell[5650, 215, 168, 5, 24, "Print"], Cell[5821, 222, 168, 5, 24, "Print"], Cell[5992, 229, 168, 5, 24, "Print"], Cell[6163, 236, 168, 5, 24, "Print"], Cell[6334, 243, 168, 5, 24, "Print"], Cell[6505, 250, 190, 6, 24, "Print"], Cell[6698, 258, 189, 6, 24, "Print"], Cell[6890, 266, 172, 5, 24, "Print"], Cell[7065, 273, 190, 6, 24, "Print"], Cell[7258, 281, 189, 6, 24, "Print"], Cell[7450, 289, 189, 6, 24, "Print"], Cell[7642, 297, 172, 5, 24, "Print"], Cell[7817, 304, 188, 6, 24, "Print"], Cell[8008, 312, 177, 6, 24, "Print"], Cell[8188, 320, 190, 6, 24, "Print"], Cell[8381, 328, 178, 6, 24, "Print"], Cell[8562, 336, 190, 6, 24, "Print"], Cell[8755, 344, 181, 6, 24, "Print"], Cell[8939, 352, 190, 6, 24, "Print"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[9190, 365, 175, 6, 64, "Section"], Cell[9368, 373, 354, 8, 32, "Input"], Cell[CellGroupData[{ Cell[9747, 385, 498, 15, 32, "Input"], Cell[10248, 402, 802, 27, 400, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[11087, 434, 659, 20, 75, "Input"], Cell[CellGroupData[{ Cell[11771, 458, 167, 5, 24, "Print"], Cell[11941, 465, 167, 5, 24, "Print"], Cell[12111, 472, 167, 5, 24, "Print"], Cell[12281, 479, 168, 5, 24, "Print"], Cell[12452, 486, 189, 6, 24, "Print"], Cell[12644, 494, 168, 5, 24, "Print"], Cell[12815, 501, 168, 5, 24, "Print"], Cell[12986, 508, 189, 6, 24, "Print"], Cell[13178, 516, 189, 6, 24, "Print"], Cell[13370, 524, 191, 6, 24, "Print"], Cell[13564, 532, 190, 6, 24, "Print"], Cell[13757, 540, 190, 6, 24, "Print"], Cell[13950, 548, 189, 6, 24, "Print"], Cell[14142, 556, 189, 6, 24, "Print"], Cell[14334, 564, 189, 6, 24, "Print"], Cell[14526, 572, 172, 5, 24, "Print"], Cell[14701, 579, 190, 6, 24, "Print"], Cell[14894, 587, 179, 6, 24, "Print"], Cell[15076, 595, 191, 6, 24, "Print"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] } ] *)