CH 03
CH 03
• Identities
(0 + w) mod n = w mod n
(1 + w) mod n = w mod n
• Additive inverse (-w)
For each w Zn, there exists a z such that w + z ≡ 0 mod n
Relatively prime, Euclid's GCD Algorithm
• Numbers with gcd(a,b)=1 are relatively prime
– eg GCD(8,15) = 1
• an efficient way to find the GCD(a,b), uses
theorem that:
gcd(a,b) = gcd(b, a % b), (*)
• Euclid's Algorithm to compute GCD(a,b):
gcd(A, B)
1. While(B>0){
1. r A % B;
2. A B;
3. B r;}
2. return A
Question is it possible to execute these in one line?
floor(ri-2 /ri-1) = ri
• A field Zn = {0,1,...,n-1} is a commutative ring in
which every nonzero element is assumed to have a
multiplicative inverse. ‘a’ is multiplicative inverse to
n, iff integer is relatively prime to n.