(************** Content-type: application/mathematica **************
CreatedBy='Mathematica 5.0'
Mathematica-Compatible Notebook
This notebook can be used with any Mathematica-compatible
application, such as Mathematica, MathReader or Publicon. The data
for the notebook starts with the line containing stars above.
To get the notebook into a Mathematica-compatible application, do
one of the following:
* Save the data starting with the line of stars above into a file
with a name ending in .nb, then open the file inside the
application;
* Copy the data starting with the line of stars above to the
clipboard, then use the Paste menu command inside the application.
Data for notebooks contains only printable 7-bit ASCII and can be
sent directly in email or through ftp in text mode. Newlines can be
CR, LF or CRLF (Unix, Macintosh or MS-DOS style).
NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing
the word CacheID, otherwise Mathematica-compatible applications may
try to use invalid cache data.
For more information on notebooks and Mathematica-compatible
applications, contact Wolfram Research:
web: http://www.wolfram.com
email: info@wolfram.com
phone: +1-217-398-0700 (U.S.)
Notebook reader applications are available free of charge from
Wolfram Research.
*******************************************************************)
(*CacheID: 232*)
(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[ 15196, 485]*)
(*NotebookOutlinePosition[ 15852, 508]*)
(* CellTagsIndexPosition[ 15808, 504]*)
(*WindowFrame->Normal*)
Notebook[{
Cell[CellGroupData[{
Cell["Gauss's Algorithm", "Title"],
Cell[BoxData[
\(p = 73\)], "Input"],
Cell[BoxData[
\(PrimeQ[p]\)], "Input"],
Cell[BoxData[
\(FactorInteger[p - 1]\)], "Input"],
Cell[CellGroupData[{
Cell["Step (1)", "Section"],
Cell[BoxData[
\(m = 2\)], "Input"],
Cell[BoxData[
\(PowerMod[2, Range[p - 1], p]\)], "Input"],
Cell[BoxData[
\(t = First[Flatten[Position[%, 1]]]\)], "Input"],
Cell[BoxData[
\(t \[Equal] p - 1\)], "Input"],
Cell[TextData[{
"The order of ",
StyleBox["m",
FontSlant->"Italic"],
" modulo ",
StyleBox["p",
FontSlant->"Italic"],
" is not ",
StyleBox["p",
FontSlant->"Italic"],
"-1, so ",
StyleBox["m",
FontSlant->"Italic"],
" is not a primitive root. Thus we must continue to step 2."
}], "Text"]
}, Open ]],
Cell[CellGroupData[{
Cell["Step (2)", "Section"],
Cell[TextData[{
"We must choose ",
StyleBox["b",
FontSlant->"Italic"],
" which is not equal to any of the first ",
StyleBox["t",
FontSlant->"Italic"],
" powers of ",
StyleBox["m",
FontSlant->"Italic"],
" modulo ",
StyleBox["p",
FontSlant->"Italic"],
"."
}], "Text"],
Cell[BoxData[
\(notb = PowerMod[m, Range[t], p]\)], "Input"],
Cell[TextData[{
"These are the candidates for ",
StyleBox["b",
FontSlant->"Italic"],
"."
}], "Text"],
Cell[BoxData[
\(Complement[Range[2, p - 1], notb]\)], "Input"],
Cell[TextData[{
"Choose ",
StyleBox["b",
FontSlant->"Italic"],
"."
}], "Text"],
Cell[BoxData[
\(b = First[%]\)], "Input"],
Cell[TextData[{
"Find the multiplicative order of ",
StyleBox["b",
FontSlant->"Italic"],
"."
}], "Text"],
Cell[BoxData[
\(u = MultiplicativeOrder[b, p]\)], "Input"],
Cell[TextData[{
"Since the multiplicative order of ",
StyleBox["b",
FontSlant->"Italic"],
" is not ",
StyleBox["p",
FontSlant->"Italic"],
"-1 ..."
}], "Text"],
Cell[BoxData[
\(u \[Equal] p - 1\)], "Input"],
Cell[TextData[{
"... we must calculate ",
StyleBox["v",
FontSlant->"Italic"],
"."
}], "Text"],
Cell[BoxData[
\(v = LCM[t, u]\)], "Input"],
Cell[BoxData[
\(a =
Apply[Times,
Intersection[Divisors[t],
Apply[Power, FactorInteger[v], {1}]]]\)], "Input"],
Cell[BoxData[
\(c =
Apply[Times,
Intersection[Divisors[u],
Apply[Power, FactorInteger[v], {1}]]]\)], "Input"],
Cell[BoxData[
\(v \[Equal] a*c\)], "Input"],
Cell[BoxData[
\(GCD[a, c]\)], "Input"],
Cell[TextData[{
"Calculate ",
Cell[BoxData[
\(TraditionalForm\`m\_1\)]],
"."
}], "Text"],
Cell[BoxData[
\(m1 = PowerMod[m, t/a, p]\)], "Input"],
Cell[TextData[{
"Calculate ",
Cell[BoxData[
\(TraditionalForm\`b\_1\)]],
"."
}], "Text"],
Cell[BoxData[
\(b1 = PowerMod[b, u/c, p]\)], "Input"],
Cell[BoxData[
\(g = m1*b1\)], "Input"],
Cell[TextData[{
"If ",
StyleBox["v",
FontSlant->"Italic"],
" equals ",
StyleBox["p",
FontSlant->"Italic"],
"-1 then ",
StyleBox["g",
FontSlant->"Italic"],
" is a primitive root. Otherwise we must proceed to step 3."
}], "Text"],
Cell[BoxData[
\(v \[Equal] p - 1\)], "Input"]
}, Open ]],
Cell[CellGroupData[{
Cell["Step (3)", "Section"],
Cell[BoxData[
\(t = v\)], "Input"],
Cell[BoxData[
\(m = m1*b1\)], "Input"]
}, Open ]],
Cell[CellGroupData[{
Cell["Step (2.1)", "Section"],
Cell[TextData[{
"We must choose ",
StyleBox["b",
FontSlant->"Italic"],
" which is not equal to any of the first ",
StyleBox["t",
FontSlant->"Italic"],
" powers of ",
StyleBox["m",
FontSlant->"Italic"],
" modulo ",
StyleBox["p",
FontSlant->"Italic"],
"."
}], "Text"],
Cell[BoxData[
\(notb = PowerMod[m, Range[t], p]\)], "Input"],
Cell[TextData[{
"These are the candidates for ",
StyleBox["b",
FontSlant->"Italic"],
"."
}], "Text"],
Cell[BoxData[
\(Complement[Range[2, p - 1], notb]\)], "Input"],
Cell[TextData[{
"Choose ",
StyleBox["b",
FontSlant->"Italic"],
"."
}], "Text"],
Cell[BoxData[
\(b = First[%]\)], "Input"],
Cell[TextData[{
"Find the multiplicative order of ",
StyleBox["b",
FontSlant->"Italic"],
"."
}], "Text"],
Cell[BoxData[
\(u = MultiplicativeOrder[b, p]\)], "Input"],
Cell[TextData[{
"Since the multiplicative order of ",
StyleBox["b",
FontSlant->"Italic"],
" is ",
StyleBox["p",
FontSlant->"Italic"],
"-1 ..."
}], "Text"],
Cell[BoxData[
\(u \[Equal] p - 1\)], "Input"],
Cell["... we have found a primitive root.", "Text"],
Cell[BoxData[
RowBox[{\(Extract::"partd"\), \(\(:\)\(\ \)\), "\<\"Part specification \
\\!\\({2, 2}\\) is longer than depth of object. \\!\\(\\*ButtonBox[\\\"More\
\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::partd\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(Extract::"partd"\), \(\(:\)\(\ \)\), "\<\"Part specification \
\\!\\({2, 2}\\) is longer than depth of object. \\!\\(\\*ButtonBox[\\\"More\
\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::partd\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(ReplacePart::"partw"\), \(\(:\)\(\ \)\), "\<\"Part \\!\\({2, 2}\
\\) of \\!\\(Null\\) does not exist. \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\
\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::partw\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(Set::"shape"\), \(\(:\)\(\ \)\), "\<\"Lists \
\\!\\({\\({System`Convert`HTMLDump`pos1$1281, \
System`Convert`HTMLDump`pos2$1281}\\)}\\) and \\!\\({}\\) are not the same \
shape. \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", \
ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"Set::shape\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(StringTake::"seqs"\), \(\(:\)\(\ \)\), "\<\"Sequence \
specification (+n, -n, {+n}, {-n}, {m, n}, or {m, n, s}) expected at position \
\\!\\(2\\) in \\!\\(StringTake[\\(\\(\\(\\(\\\"\\\\n\\\\nList2<\
Number>2\\\"\\)\\), \\(\\(\
\[LeftSkeleton] 1 \[RightSkeleton]\\)\\)\\)\\)]\\). \
\\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\
\\\", ButtonFrame->None, ButtonData:>\\\"General::seqs\\\"]\\)\"\>"}]], \
"Message"],
Cell[BoxData[
RowBox[{\(StringDrop::"seqs"\), \(\(:\)\(\ \)\), "\<\"Sequence \
specification (+n, -n, {+n}, {-n}, {m, n}, or {m, n, s}) expected at position \
\\!\\(2\\) in \\!\\(StringDrop[\\(\\(\\(\\(\\\"\\\\n\\\\nList2<\
Number>2\\\"\\)\\), \\(\\(\
\[LeftSkeleton] 33 \[RightSkeleton]\\)\\)\\)\\)]\\). \
\\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\
\\\", ButtonFrame->None, ButtonData:>\\\"General::seqs\\\"]\\)\"\>"}]], \
"Message"],
Cell[BoxData[
RowBox[{\(Extract::"partd"\), \(\(:\)\(\ \)\), "\<\"Part specification \
\\!\\({2, 2}\\) is longer than depth of object. \\!\\(\\*ButtonBox[\\\"More\
\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::partd\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(General::"stop"\), \(\(:\)\(\ \)\), "\<\"Further output of \
\\!\\(Extract :: \\\"partd\\\"\\) will be suppressed during this calculation. \
\\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\
\\\", ButtonFrame->None, ButtonData:>\\\"General::stop\\\"]\\)\"\>"}]], \
"Message"],
Cell[BoxData[
RowBox[{\(ReplacePart::"partw"\), \(\(:\)\(\ \)\), "\<\"Part \\!\\({2, 2}\
\\) of \\!\\(Null\\) does not exist. \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\
\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::partw\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(Set::"shape"\), \(\(:\)\(\ \)\), "\<\"Lists \
\\!\\({\\({System`Convert`HTMLDump`pos1$1357, \
System`Convert`HTMLDump`pos2$1357}\\)}\\) and \\!\\({}\\) are not the same \
shape. \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", \
ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"Set::shape\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(StringTake::"seqs"\), \(\(:\)\(\ \)\), "\<\"Sequence \
specification (+n, -n, {+n}, {-n}, {m, n}, or {m, n, s}) expected at position \
\\!\\(2\\) in \\!\\(StringTake[\\(\\(\\(\\(\\\"\\\\n\\\\nList2<\
Number>2\\\"\\)\\), \\(\\(\
\[LeftSkeleton] 1 \[RightSkeleton]\\)\\)\\)\\)]\\). \
\\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\
\\\", ButtonFrame->None, ButtonData:>\\\"General::seqs\\\"]\\)\"\>"}]], \
"Message"],
Cell[BoxData[
RowBox[{\(StringDrop::"seqs"\), \(\(:\)\(\ \)\), "\<\"Sequence \
specification (+n, -n, {+n}, {-n}, {m, n}, or {m, n, s}) expected at position \
\\!\\(2\\) in \\!\\(StringDrop[\\(\\(\\(\\(\\\"\\\\n\\\\nList2<\
Number>2\\\"\\)\\), \\(\\(\
\[LeftSkeleton] 33 \[RightSkeleton]\\)\\)\\)\\)]\\). \
\\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\
\\\", ButtonFrame->None, ButtonData:>\\\"General::seqs\\\"]\\)\"\>"}]], \
"Message"],
Cell[BoxData[
RowBox[{\(ReplacePart::"partw"\), \(\(:\)\(\ \)\), "\<\"Part \\!\\({2, 2}\
\\) of \\!\\(Null\\) does not exist. \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\
\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::partw\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(General::"stop"\), \(\(:\)\(\ \)\), "\<\"Further output of \
\\!\\(ReplacePart :: \\\"partw\\\"\\) will be suppressed during this \
calculation. \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", \
ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::stop\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(Set::"shape"\), \(\(:\)\(\ \)\), "\<\"Lists \
\\!\\({\\({System`Convert`HTMLDump`pos1$1423, \
System`Convert`HTMLDump`pos2$1423}\\)}\\) and \\!\\({}\\) are not the same \
shape. \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", \
ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"Set::shape\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(General::"stop"\), \(\(:\)\(\ \)\), "\<\"Further output of \
\\!\\(Set :: \\\"shape\\\"\\) will be suppressed during this calculation. \\!\
\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", \
ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::stop\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(StringTake::"seqs"\), \(\(:\)\(\ \)\), "\<\"Sequence \
specification (+n, -n, {+n}, {-n}, {m, n}, or {m, n, s}) expected at position \
\\!\\(2\\) in \\!\\(StringTake[\\(\\(\\(\\(\\\"\\\\n\\\\nList2<\
Number>2\\\"\\)\\), \\(\\(\
\[LeftSkeleton] 1 \[RightSkeleton]\\)\\)\\)\\)]\\). \
\\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\
\\\", ButtonFrame->None, ButtonData:>\\\"General::seqs\\\"]\\)\"\>"}]], \
"Message"],
Cell[BoxData[
RowBox[{\(General::"stop"\), \(\(:\)\(\ \)\), "\<\"Further output of \
\\!\\(StringTake :: \\\"seqs\\\"\\) will be suppressed during this \
calculation. \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", \
ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::stop\\\"]\\)\"\>"}]], "Message"],
Cell[BoxData[
RowBox[{\(StringDrop::"seqs"\), \(\(:\)\(\ \)\), "\<\"Sequence \
specification (+n, -n, {+n}, {-n}, {m, n}, or {m, n, s}) expected at position \
\\!\\(2\\) in \\!\\(StringDrop[\\(\\(\\(\\(\\\"\\\\n\\\\nList2<\
Number>2\\\"\\)\\), \\(\\(\
\[LeftSkeleton] 33 \[RightSkeleton]\\)\\)\\)\\)]\\). \
\\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\
\\\", ButtonFrame->None, ButtonData:>\\\"General::seqs\\\"]\\)\"\>"}]], \
"Message"],
Cell[BoxData[
RowBox[{\(General::"stop"\), \(\(:\)\(\ \)\), "\<\"Further output of \
\\!\\(StringDrop :: \\\"seqs\\\"\\) will be suppressed during this \
calculation. \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", \
ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
ButtonData:>\\\"General::stop\\\"]\\)\"\>"}]], "Message"]
}, Open ]]
}, Open ]]
},
FrontEndVersion->"5.0 for X",
ScreenRectangle->{{0, 1280}, {0, 1024}},
WindowSize->{1280, 953},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
CellLabelAutoDelete->True
]
(*******************************************************************
Cached data follows. If you edit this Notebook file directly, not
using Mathematica, you must remove the line containing CacheID at
the top of the file. The cache data will then be recreated when
you save this file from within Mathematica.
*******************************************************************)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[1776, 53, 34, 0, 96, "Title"],
Cell[1813, 55, 39, 1, 27, "Input"],
Cell[1855, 58, 42, 1, 27, "Input"],
Cell[1900, 61, 53, 1, 27, "Input"],
Cell[CellGroupData[{
Cell[1978, 66, 27, 0, 72, "Section"],
Cell[2008, 68, 38, 1, 27, "Input"],
Cell[2049, 71, 61, 1, 27, "Input"],
Cell[2113, 74, 67, 1, 27, "Input"],
Cell[2183, 77, 49, 1, 27, "Input"],
Cell[2235, 80, 318, 14, 32, "Text"]
}, Open ]],
Cell[CellGroupData[{
Cell[2590, 99, 27, 0, 72, "Section"],
Cell[2620, 101, 299, 14, 32, "Text"],
Cell[2922, 117, 64, 1, 27, "Input"],
Cell[2989, 120, 110, 5, 32, "Text"],
Cell[3102, 127, 66, 1, 27, "Input"],
Cell[3171, 130, 88, 5, 32, "Text"],
Cell[3262, 137, 45, 1, 27, "Input"],
Cell[3310, 140, 114, 5, 32, "Text"],
Cell[3427, 147, 62, 1, 27, "Input"],
Cell[3492, 150, 176, 8, 32, "Text"],
Cell[3671, 160, 49, 1, 27, "Input"],
Cell[3723, 163, 103, 5, 32, "Text"],
Cell[3829, 170, 46, 1, 27, "Input"],
Cell[3878, 173, 140, 4, 27, "Input"],
Cell[4021, 179, 140, 4, 27, "Input"],
Cell[4164, 185, 47, 1, 27, "Input"],
Cell[4214, 188, 42, 1, 27, "Input"],
Cell[4259, 191, 100, 5, 32, "Text"],
Cell[4362, 198, 57, 1, 27, "Input"],
Cell[4422, 201, 100, 5, 32, "Text"],
Cell[4525, 208, 57, 1, 27, "Input"],
Cell[4585, 211, 42, 1, 27, "Input"],
Cell[4630, 214, 253, 11, 32, "Text"],
Cell[4886, 227, 49, 1, 27, "Input"]
}, Open ]],
Cell[CellGroupData[{
Cell[4972, 233, 27, 0, 72, "Section"],
Cell[5002, 235, 38, 1, 27, "Input"],
Cell[5043, 238, 42, 1, 27, "Input"]
}, Open ]],
Cell[CellGroupData[{
Cell[5122, 244, 29, 0, 72, "Section"],
Cell[5154, 246, 299, 14, 32, "Text"],
Cell[5456, 262, 64, 1, 27, "Input"],
Cell[5523, 265, 110, 5, 32, "Text"],
Cell[5636, 272, 66, 1, 27, "Input"],
Cell[5705, 275, 88, 5, 32, "Text"],
Cell[5796, 282, 45, 1, 27, "Input"],
Cell[5844, 285, 114, 5, 32, "Text"],
Cell[5961, 292, 62, 1, 27, "Input"],
Cell[6026, 295, 172, 8, 32, "Text"],
Cell[6201, 305, 49, 1, 27, "Input"],
Cell[6253, 308, 51, 0, 32, "Text"],
Cell[6307, 310, 303, 4, 20, "Message"],
Cell[6613, 316, 303, 4, 20, "Message"],
Cell[6919, 322, 294, 4, 20, "Message"],
Cell[7216, 328, 366, 6, 20, "Message"],
Cell[7585, 336, 708, 11, 46, "Message"],
Cell[8296, 349, 709, 11, 46, "Message"],
Cell[9008, 362, 303, 4, 20, "Message"],
Cell[9314, 368, 332, 5, 20, "Message"],
Cell[9649, 375, 294, 4, 20, "Message"],
Cell[9946, 381, 366, 6, 20, "Message"],
Cell[10315, 389, 708, 11, 46, "Message"],
Cell[11026, 402, 709, 11, 46, "Message"],
Cell[11738, 415, 294, 4, 20, "Message"],
Cell[12035, 421, 336, 5, 20, "Message"],
Cell[12374, 428, 366, 6, 20, "Message"],
Cell[12743, 436, 328, 5, 20, "Message"],
Cell[13074, 443, 708, 11, 46, "Message"],
Cell[13785, 456, 334, 5, 20, "Message"],
Cell[14122, 463, 709, 11, 46, "Message"],
Cell[14834, 476, 334, 5, 20, "Message"]
}, Open ]]
}, Open ]]
}
]
*)
(*******************************************************************
End of Mathematica Notebook file.
*******************************************************************)