Introduction to Number
Theory
Chapter 8
Modular Arithmetic
Remainder of a Large Number
Prime Numbers
Prime numbers only have divisors of 1 and self
They cannot be written as a product of other numbers
Note 1 is a non prime number
List of prime number less than 200 is:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59
61 67 71 73 79 83 89 97 101 103 107 109 113 127
131 137 139 149 151 157 163 167 173 179 181 191
193 197 199
Relatively Prime Numbers &
GCD
Two numbers a and b are relatively prime if
have no common divisors apart from 1
e.g. 8 & 15 are relatively prime since factors of 8 are
1,2,4,8 and of 15 are 1,3,5,15 and 1 is the only
common factor
Conversely can determine the greatest common
divisor by comparing their prime factorizations
and using least powers
Fermat's Theorem
ap-1 = 1 (mod p)
where p is prime and gcd(a,p)=1
Useful in public key and primality testing.
Euler Totient Function ø(n)
When doing arithmetic modulo n
Complete set of residues is: 0..n-1
Reduced set of residues is those numbers
(residues) which are relatively prime to n
e.g. for n=10,
complete set of residues is {0,1,2,3,4,5,6,7,8,9}
reduced set of residues is {1,3,7,9}
Number of elements in reduced set of residues
is called the Euler Totient Function ø(n)
Euler Totient Function ø(n)
To compute ø(n) need to count number of
residues to be excluded
In general need prime factorization, but
for p (p prime) ø(p) = p-1
for p.q (p,q prime) ø(pq) =(p-1)x(q-1)
e.g.
ø(37) = 36
ø(21) = (3–1)x(7–1) = 2x6 = 12
Euler's Theorem
A generalisation of Fermat's Theorem
aø(n) = 1 (mod n)
For any a,n where gcd(a,n)=1 and 0 < a < n
e.g.
a = 3;n = 10; ø(10) = 4;
hence 34 = 81 = 1 mod 10
a = 2;n = 11; ø(11) = 10;
hence 210 = 1024 = 1 mod 11
Primitive Roots
From Euler’s theorem have aø(n)modn=1
Consider am =1 (mod n), GCD(a,n)=1
must exist for m = ø(n) but may be smaller
once powers reach m, cycle will repeat
If smallest is m = ø(n) then a is called a
primitive root
If p is prime, then successive powers of a
"generate" the group mod p
These are useful but relatively hard to find
Primitive Roots contd.
Powers of integer modulo 19