O44
O44
Theorem
Let a and b be positive integers. Then ab = gcd(a, b) · lcm(a, b).
Theorem
Let a = bq + r , where a, b, q, and r are integers. Then
gcd(a, b) = gcd(b, r ).
Theorem
Let a = bq + r , where a, b, q, and r are integers. Then
gcd(a, b) = gcd(b, r ).
Euclid-GCD(a, b)
If (b = 0) then return(a)
else return(Euclid-GCD(b, a (mod b)))
Euclid-GCD(a, b)
If (b = 0) then return(a)
else return(Euclid-GCD(b, a (mod b)))
Theorem
Let a, b be positive integers.Then there exists integers x, y such
that xa + yb = gcd(a, b). Furthermore, gcd(a, b) is the smallest
positive integer that can be expressed in this way.
Theorem
Let a, b be positive integers.Then there exists integers x, y such
that xa + yb = gcd(a, b). Furthermore, gcd(a, b) is the smallest
positive integer that can be expressed in this way.
Theorem
If a, b, and c are positive integers such that gcd(a, b) = 1 and
a|bc, then a|c.
Theorem
If p is a prime and p|a1 a2 ...an , where each ai is an integer, then
p|ai for some i.
Extended-Euclid-GCD(a, b)
If(b = 0), then return(a, 1, 0)
else
Compute integers q, r such that a = qb + r and 0 ≤ r < b.
Let (d, x, y ) = Extended-Euclid-GCD(b, r )
return(d, y , x − yq)
Extended-Euclid-GCD(a, b)
If(b = 0), then return(a, 1, 0)
else
Compute integers q, r such that a = qb + r and 0 ≤ r < b.
Let (d, x, y ) = Extended-Euclid-GCD(b, r )
return(d, y , x − yq)