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
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
32 3. Fundamentals from Number Theory<br />
and<br />
bi = ai−1−qibi−1 = nxa,i−1+mya,i−1−qi(nxb,i−1+myb,i−1) =nxb,i+myb,i.<br />
In particular, the coefficients xa,t and ya,t stored <strong>in</strong> xa and ya after the last<br />
iteration of the loop satisfy gcd(n, m) =at = nxa,t + mya,t, as claimed. ⊓⊔<br />
Concern<strong>in</strong>g the <strong>ru</strong>nn<strong>in</strong>g <strong>time</strong> of the Extended Euclidean Algorithm, we<br />
note that the analysis <strong>in</strong> Lemma 3.2.3(a) carries over, so on <strong>in</strong>put n, m<br />
O(m<strong>in</strong>{log(n), log(m)}) arithmetic operations are carried out. As for the cost<br />
<strong>in</strong> terms of bit operations, we note without proof that the number of bit<br />
operations is bounded by O(log(n) log(m)) just as <strong>in</strong> the case of the simple<br />
Euclidean Algorithm.<br />
3.3 Modular Arithmetic<br />
We now turn to a different view on rema<strong>in</strong>ders: modular arithmetic. Let<br />
m ≥ 2begiven(the“modulus”). We want to say that look<strong>in</strong>g at an <strong>in</strong>teger<br />
a we are not really <strong>in</strong>terested <strong>in</strong> a but only <strong>in</strong> the rema<strong>in</strong>der a mod m. Thus,<br />
all numbers that leave the same rema<strong>in</strong>der when divided by m are considered<br />
“similar”. We def<strong>in</strong>e a b<strong>in</strong>ary relation on Z.<br />
Def<strong>in</strong>ition 3.3.1. Let m ≥ 2 be given. For arbitrary <strong>in</strong>tegers a and b we say<br />
that a is cong<strong>ru</strong>ent to b modulo m and write<br />
a ≡ b (mod m)<br />
if a mod m = b mod m.<br />
The def<strong>in</strong>ition immediately implies the follow<strong>in</strong>g properties of the b<strong>in</strong>ary<br />
relation “cong<strong>ru</strong>ence modulo m”.<br />
Lemma 3.3.2. Cong<strong>ru</strong>ence modulo m is an equivalence relation, i.e., we<br />
have<br />
Reflexivity: a ≡ a (mod m),<br />
Symmetry: a ≡ b (mod m) implies b ≡ a (mod m), and<br />
Transitivity: a ≡ b (mod m) and b ≡ c (mod m) implies a ≡ c (mod m). ⊓⊔<br />
Further, it is almost immediate from the def<strong>in</strong>itions of a mod m and of ≡<br />
that<br />
a ≡ b (mod m) if and only if m divides b − a. (3.3.5)<br />
(Write a = mq + r and b = mq ′ + r ′ with 0 ≤ r, r ′