[Download postscript version]
next up previous contents
Next: Powers modulo a prime Up: Introduction to Number Theory Previous: Congruences

The Greatest Common Divisor

For a and b, the number (a,b) is the largest number which divides a and b evenly.

displaymath990

  Th124

This can be seen by solving the equation by making a sequence of simplifying substitutions:

eqnarray127

It is easy to see that x''=1, y'=0 is a solution to the final equation and we get a solution to the original equation by working backwards:

displaymath1002

We could also solve an equation like 30x+69y=15 by multiplying our solution: y=-15, x=35. It should be clear that the equation will have no solution in integers if 15 is replaced by something that is not a multiple of (30,69)=3.

All other integer solutions of 30x+69y=15 may be obtained by changing the first solution:

displaymath1014

If we do the process illustrated on the previous page for any equation ax+by=(a,b), we eventually get one of the coefficients as zero and the other as (a,b). In fact, this process is usually presented as ``Euclid's algorithm for finding the greatest common divisor.''

It is important that this process is feasible on a computer even if a and b are several hundred digits long. It is easy to show that the larger of the two coefficients decreases by at least 1/2 every two equations, hence every twenty equations the larger coefficient has decreased by tex2html_wrap_inline1026 , so a 600-digit number would not require more than 4000 equations.

We pointed out earlier that division does not work with congruences. An important application of Theorem 1 is that it does work for prime numbers.

Co135

Co139

Co142



Adrian Perrig
Fri May 31 09:07:38 MET DST 1996