A Bit of Number Theory

Fundamental Lemma of Number Theory: Let MATH be two integers. There exits unique integers $\QTR{Large}{q}$ and $\QTR{Large}{r}$ with MATH and

MATH

Note: Uniqueness follows from the fact that MATH implies

MATH

Definition: Let MATH be two integers. The greatest common divisor of $\QTR{Large}{m}$ and $\QTR{Large}{n}$ is defined to be largest integer $\QTR{Large}{d}$ such that

$\QTR{Large}{d}$ divides both $\QTR{Large}{m}$ and $\QTR{Large}{m}$ .

Notation MATH.

Since $\QTR{Large}{1}$ divides both $\QTR{Large}{m}$ and $\QTR{Large}{n}$ , we can use induction to show that MATH exists. For that matter, since MATH one can compute $\QTR{Large}{d}$ (very inefficiently!) by

trying all values, starting at $\QTR{Large}{1}$ and ending at the least of $\QTR{Large}{|m|}$ and $\QTR{Large}{|n|}.$

Examples: MATH. MATH MATH

Lemma: Suppose MATH then MATH.

$\qquad $PROOF: In fact all of their common divisors are in common!

The Euclidean Algorithm for computing MATH: (See the proof below)

Theorem( Extended Euclidean Algorithm): Let MATH There exists integers $\QTR{Large}{a}$ and $\QTR{Large}{b}$ , computable using the Euclidean Algorithm such that

MATH

$\vspace{1pt}$

$\qquad $PROOF: (By induction)

If $\QTR{Large}{m=n}$ the theorem is trivial so for simplicity assume that $\QTR{Large}{m>n>0}$. Again if $\QTR{Large}{n}$ divides $\QTR{Large}{m}$ the theorem is trivial so assume

MATH $\ \QTR{bf}{\ \ }$henceMATH

If $\QTR{Large}{r}_{1}$ divides $\QTR{Large}{n}$ then MATH and MATH.

Otherwise

MATH $\ \QTR{bf}{\ \ }$henceMATH and

MATH or MATH again if $\QTR{Large}{r}_{2}$ divides $\QTR{Large}{r}_{1}$ we are done else......

Example- Compute MATH

Computing the simple-minded way requires MATH long divisions. Divide $\QTR{Large}{746}$ and $\QTR{Large}{83}$ by $\QTR{Large}{2}$ through $\QTR{Large}{41}$.

Now by the euclidean algorithm,

MATH

MATH $1$

MATH

MATH

MATH

This admittedly is an easy example but we see that EA requires $3$ long divisions to find MATH .

Lemma: Suppose $\QTR{Large}{p}$ is prime (the only divisors are $\QTR{Large}{p}$ and $\QTR{Large}{1}$). Suppose $\QTR{Large}{p}$ divides $\QTR{Large}{cd}$ then $\QTR{Large}{p}$ divides $\QTR{Large}{c}$or $\QTR{Large}{p}$ divides $\QTR{Large}{d}$.

$\qquad $PROOF: Suppose $\QTR{Large}{p}$ does not divide $\QTR{Large}{c}$, then MATH. Thus there exists integers $\QTR{Large}{a}$ and $\QTR{Large}{b}$ , such that

MATH

Multiplying both sides of the equation by $\QTR{Large}{d}$ gives$\left( {}\right) $

MATH

Since both terms on the left hand side are divisible by $\QTR{Large}{p}$ so is the right hand side.

Simple Observation: Let $\QTR{Large}{p}$ and $\QTR{Large}{q}$ be primes. Let $\QTR{Large}{m=pq}$. The only divisors of $\QTR{Large}{m}$ are $\QTR{Large}{p}$, $\QTR{Large}{q}$, and $\QTR{Large}{1}$.

A Big Question: Suppose I know that $\QTR{Large}{m}$ is the product of two primes $\QTR{Large}{p}$ and $\QTR{Large}{q}$. How hard is it to compute this primes? Again there is a simple-minded answer. MATH. Hence we only have to do at most MATH long divisions.

Suppose $\QTR{Large}{m}$ has $\QTR{Large}{500}$ digits, how long might that take?