{VERSION 5 0 "IBM INTEL LINUX" "5.0" }
{USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0
1 0 0 0 0 1 }{CSTYLE "" -1 256 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }
{CSTYLE "" -1 257 "" 1 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{PSTYLE "Normal
" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0
-1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1
"" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 }
{PSTYLE "Heading 2" 3 4 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 0 0 0 0
0 0 0 0 0 }0 0 0 -1 8 2 0 0 0 0 0 0 -1 0 }}
{SECT 0 {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{SECT 1
{PARA 3 "" 0 "" {TEXT -1 19 "Modular Arithmetic" }}{EXCHG {PARA 0 ""
0 "" {TEXT -1 107 "Doing arithmetic mod m is critical in number theory
. Fortunately, Maple makes has some built in functions" }}{PARA 0 "
" 0 "" {TEXT -1 33 "that make computing mod n simple." }}{PARA 0 "" 0
"" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "73 -590 \+
mod 73;\n25*73 mod 99;" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 69 "To make Maple think before it computes, u
se the \"neutral operator\" &." }}{PARA 0 "" 0 "" {TEXT -1 177 "You'll
see the difference here. In the first case it computes 66^1235346462
356 and then reduces. In the second it uses the repeated squaring met
hod and reduces as it proceeds." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 24 "66^1235346462356 mod 99;" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 26 "66 &^1235346462356 mod 99;" }}}{EXCHG {PARA 0 "" 0 "
" {TEXT -1 62 "Inverting mod n is simple. Of course it isn't always d
efined." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "53^(-1) mod 99; \+
\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "66^(-1) mod 99;" }}
{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 113 "Let u be a u
nit mod n. now consider all of the powers of u. We will see in class
that they must all be units. " }}{PARA 0 "" 0 "" {TEXT -1 102 "The f
irst repetition in the sequence u^k mod n for k = 0 to infinity is som
e r such that u^r= 1 mod n." }}{PARA 0 "" 0 "" {TEXT -1 39 "We call r \+
the \"order of u modulo n\". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "" 0 "" {TEXT -1 19 "Here is an example." }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "n:= 19;\n\n
u := 4;\n " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "for i from 1 \+
to n do\n i, u^i mod n;\nod; \n " }}}{EXCHG {PARA 0 "" 0 "" {TEXT
-1 85 "So the order of 2 mod 19 is 18.\nNow change the value of u and \+
see what orders occur.\n" }}{PARA 0 "" 0 "" {TEXT -1 35 "You can also \+
change the value of n." }}{PARA 0 "" 0 "" {TEXT -1 42 "What should you
watch for as you change n?" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 0 {PARA 4 "" 0 "
" {TEXT -1 9 "Exercises" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 98 "1) Wri
te a procedure that, given u and n ,finds the order of u modulo n. Us
e the for loop above." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0
"" {TEXT -1 181 "2) Write a procedure that, given n, outputs each uni
t u and the order of that unit.\n\n3) Write a procedure that, given n
, outputs the number of units mod n that have a given order." }}{PARA
0 "" 0 "" {TEXT -1 66 " That is count the number of elements of \+
order r and output " }}{PARA 0 "" 0 "" {TEXT -1 43 " r, the number
of elements of order r.\n" }}{PARA 0 "" 0 "" {TEXT -1 54 "4) Experime
nt! What orders do you get? And how many." }}}}}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 19 "Solving
Polynomials" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "You can also solve
equations modulo m." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "mso
lve(\{3*x-4*y=1,7*x+y=2\},19);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 82
"Integers a such that x^2 = a mod m has a solution are called quadrati
c residues. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "msolve(x^2
= 5 , 17); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "msolve(x^2 \+
= 8, 17);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "msolve(x^2= 1,
8);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0
"> " 0 "" {MPLTEXT 1 0 0 "" }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 "Linear Algebra" }}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 40 "Now let's do some linear algebra mod m;.
" }}{PARA 0 "" 0 "" {TEXT -1 57 "We need to include a package of linea
r algebra functions." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA
0 "> " 0 "" {MPLTEXT 1 0 20 "with(LinearAlgebra);" }}}{EXCHG {PARA 0 "
> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8
"m := 19;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 112 "A 2 by 2 Random Mat
rix can be produced. If you want the entries to be mod m, then put i
n the generator clause." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "
N := RandomMatrix(2,2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "
N := RandomMatrix(2,2,generator=0..m-1);" }}}{EXCHG {PARA 0 "" 0 ""
{TEXT -1 75 "I'll define my own function to invert a matrix and to mul
tiply to matrices." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "ModIn
v := (M , m)-> map( modp, M^(-1), m);" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 20 "Ninv := ModInv(N,m);" }}}{EXCHG {PARA 0 "" 0 ""
{TEXT -1 40 "The following doesnt work unfortunately." }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "N^2 mod m;" }}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 40 "ModMul := (M,N, m) -> map(modp, M.N, m);" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "ModMul(N,N,m);" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "ModMul(N,Ninv,m);" }}}{EXCHG {PARA
0 "> " 0 "" {MPLTEXT 1 0 49 "Determinant(N, method = modular[m]); 16*1
5 mod m;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 121 "Unfortunately, the N
ullspace command, which is used over finite fields, seems to require m
atrices rather than Matrices. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 20 "Nullspace(N) mod 19;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 41 "N1 := convert(N, matrix);type(N1,matrix);" }}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 22 "Nullspace(N1) mod 19; " }}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 40 "N2 := linalg[submatrix](N1, 1..1,1..2); " }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Nullspace(N2) mod 19;" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 " Two Exercises" }}
{PARA 0 "" 0 "" {TEXT -1 212 "1. Make a list of all (less than some b
ound) the Fibonacci numbers which are also perfect squares. List also
the index of the Fibonacci number. Try it by a brute force method an
d then try to be more efficient." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "" 0 "" {TEXT -1 48 "2. Which Fibonacci numbers are divisible
by 17?" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT 256 0 "" }{TEXT 257 0
"" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "1" 0 }
{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }