Dietzfelbinger M. Primality testing in polynomial time ... - tiera.ru
Dietzfelbinger M. Primality testing in polynomial time ... - tiera.ru
Dietzfelbinger M. Primality testing in polynomial time ... - tiera.ru
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
26 3. Fundamentals from Number Theory<br />
The follow<strong>in</strong>g property of division with rema<strong>in</strong>der is essential for the<br />
Euclidean Algorithm, an efficient method for calculat<strong>in</strong>g the greatest common<br />
divisor of two numbers (see Sect. 3.2).<br />
Proposition 3.1.10. If m ≥ 1, thengcd(n, m) =gcd(n mod m, m) for all<br />
<strong>in</strong>tegers n.<br />
Proof. S<strong>in</strong>ce n mod m = n − qm for q = n div m, this is a special case of<br />
Proposition 3.1.7(d). ⊓⊔<br />
The greatest common divisor of n and m has an important property,<br />
which is basic for many arguments and const<strong>ru</strong>ctions <strong>in</strong> this book: it is an<br />
<strong>in</strong>tegral l<strong>in</strong>ear comb<strong>in</strong>ation of n and m.<br />
Proposition 3.1.11. For arbitrary <strong>in</strong>tegers n and m there are <strong>in</strong>tegers x<br />
and y such that<br />
gcd(n, m) =nx + my.<br />
Proof. If n =0orm =0,either(x, y) =(1, 1) or (x, y) =(−1, −1) will be<br />
suitable. So assume both n and m are nonzero. Let I = {nu + mv | u, v ∈ Z}.<br />
Then I has positive elements, e.g., n 2 + m 2 is a positive element of I. Choose<br />
x and y so that d = nx + my > 0isthesmallest positive element <strong>in</strong> I. We<br />
claim that d =gcd(n, m).<br />
For this we must show that<br />
(i) d ∈ D(n) ∩ D(m), and that<br />
(ii) all positive elements of D(n) ∩ D(m) divide d.<br />
Assertion (ii) is simple: use that if k divides n and m, thenk divides nx and<br />
my, hence also the sum d = nx + my. To prove (i), we show that d divides n;<br />
the proof for m is the same. By Proposition 3.1.8, we may write n = dq + r<br />
for some <strong>in</strong>teger q and some r with 0 ≤ r 0, and write d = nx + my for <strong>in</strong>tegers x and y. Thenkd =<br />
(kn)x +(km)y, hence every common divisor of kn and km divides kd. On<br />
the other hand, it is clear that kd divides both kn and km. Thus,kd =<br />
gcd(kn, km). ⊓⊔<br />
The follow<strong>in</strong>g most important special case of Proposition 3.1.11 will be<br />
used without further comment later.