Unit 6 Ppts Cse408
Unit 6 Ppts Cse408
Overview
3 Euclid’s Algorithm
4 Modular Arithmetic
Prime Factorization
For n and m where they are both nonzero, the least common
multiple is denoted lcm�n,m)
For example lcm�6,9) = 18 because 6|18 and 9 |18
The lcm�n,m) is a product of primes that are common to m and n,
where the power of each prime in the product is the larger of its
orders in n and m
So 12 = 22 31 and 45 = 32 51
so lcm�12,45) = 22 32 51 = 180
Euclid’s Algorithm
else
return gcd�m, n mod m);
}
Time Complexity
This last equality combined with the worst case for number of bit
manipulations and recursive calls results is bounded from above by
= c�lgn × lgm + lgm + lgr + lg �mmodr ) + . . . � Since
n > m > r > mmodr > . . . where the dots denote the remaining
terms.
We conclude W �s� t) ∈ ��st)
Group Theory
Congruency Modulo n
This will work if we only include the relatively prime numbers for
example
z9∗ = �[1]9 � [2]9 � [4]9 � [5]9 � [7]9 � [8]9 }
Using �z9∗ � ×) we have the following multiplicative inverses
[1]9 ∗ [1]9 = [1]9
[2]9 ∗ [5]9 = [10]9 = [1]9
[4]9 ∗ [7]9 = [28]9 = [1]9
[8]9 ∗ [8]9 = [64]9 = [1]9
The number of elements ∗
� �in zn is given by Euler’s totient function
ϕ �n) = n p:p�n 1 − p1 For example
�
� �
ϕ �60) = 60 p:p�60 1 − p1 = 60 1 − 12 1 − 13 1 − 15 = 16
� � �� �� �
SubGroups
SubGroups �cont)
SubGroups �cont)
Also Fermat has shown that if p is prime then for all [m]p ∈ �p
� �p−1
[m]p = [1]p
For example group ��7 � ×). We have that
�[2]7 )7−1 = [64]7 = [1]7
The input size in our linear solver is the number of bits it takes to
encode input
s = �lgn� + 1
t = �lgm� + 1
u = �lgk� + 1
The time complexity for Euclid’s Algorithm is O�st), plus the time
complexity for the for-w loop.
Since d can be as large as m or n, this time complexity is
worst-case exponential in terms of input size.