Greatest Common Denominator

Lemma 1

Let a,b,q,rZa,b,q, r \in \Z such that a=bq+ra=b\cdot q + r
Then gcd(a,b)=gcd(b,r)\mathrm{gcd}(a,b) = \mathrm{gcd}(b,r)

Euclid's Algorithm (a, b)

x=ax = a
y=by = b
while y0y \neq 0
r=x mod yr = x \ \mathrm{mod} \ y
y=ry = r
return xx

Bezout's Theorem

Let a,bZ+a,b \in \Z^+.
There exists s,tZs,t \in \Z such that:
sa+tb=gcd(a,b)s\cdot a + t\cdot b = \mathrm{gcd}(a,b)

Lemma 2

Let a,b,cZ+a,b,c \in \Z^+
If gcd(a,b)=1(a,b) = 1 and abca|bc, then aca|c

Lemma 3

Let pp be a prime number and a1,a2,...,ana_1, a_2, ..., a_n be integers.
If pa1a2...anp|a_1\cdot a_2 \cdot ... \cdot a_n, then there exists 1in1 \leq i \leq n with paip|a_i

Theorem

Let m2m \geq 2 be a positive integer and a,b,cZa,b,c \in \Z such that acbc(modm)ac \equiv bc \pmod{m} and gcd(c,m)=1(c,m) = 1.
Then ab(modm)a\equiv b \pmod{m}