10.12.2012 Views

Prime Numbers

Prime Numbers

Prime Numbers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.1 Modular arithmetic 87<br />

and such operation counts depend on the binary expansion of the exponent n,<br />

with typical operation counts being dramatically less than the value of n itself.<br />

In fact, if x, n are integers the size of m, and we are to compute x n mod m<br />

via naive multiply/add arithmetic and Algorithm 2.1.5, then O(ln 3 m)bit<br />

operations suffice for the powering (see Exercise 2.17 and Section 9.3.1).<br />

2.1.3 Chinese remainder theorem<br />

The Chinese remainder theorem (CRT) is a clever, and very old, idea from<br />

which one may infer an integer value on the basis of its residues modulo<br />

an appropriate system of smaller moduli. The CRT was known to Sun-Zi in<br />

the first century a.d. [Hardy and Wright 1979], [Ding et al. 1996]; in fact a<br />

legendary ancient application is that of counting a troop of soldiers. If there<br />

are n soldiers, and one has them line up in justified rows of 7 soldiers each,<br />

one inspects the last row and infers n mod 7, while lining them up in rows of<br />

11 will give n mod 11, and so on. If one does “enough” such small-modulus<br />

operations, one can infer the exact value of n. In fact, one does not need the<br />

small moduli to be primes; it is sufficient that the moduli be pairwise coprime.<br />

Theorem 2.1.6 (Chinese remainder theorem (CRT)). Let m0,...,mr−1<br />

be positive, pairwise coprime moduli with product M =Π r−1<br />

i=0 mi. Letrre spective residues ni also be given. Then the system comprising the r relations<br />

and inequality<br />

n ≡ ni (mod mi), 0 ≤ n

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!