Prime Numbers
Prime Numbers Prime Numbers
88 Chapter 2 NUMBER-THEORETICAL TOOLS Indeed, 62 modulo 3, 5, 7, respectively, gives the required residues 2, 2, 6. Though ancient, the CRT algorithm still finds many applications. Some of these are discussed in Chapter 8.8 and its exercises. For the moment, we observe that the CRT affords a certain “parallelism.” A set of separate machines can perform arithmetic, each machine doing this with respect to a small modulus mi, whence some final value may be reconstructed. For example, if each of x, y has fewer than 100 digits, then a set of prime moduli {mi} whose product is M > 10 200 can be used for multiplication: The i-th machine would find ((x mod mi) ∗ (y mod mi)) mod mi, and the final value x ∗ y would be found via the CRT. Likewise, on one computer chip, separate multipliers can perform the small-modulus arithmetic. All of this means that the reconstruction problem is paramount; indeed, the reconstruction of n tends to be the difficult phase of CRT computations. Note, however, that if the small moduli are fixed over many computations, a certain amount of one-time precomputation is called for. In Theorem 2.1.6, one may compute the Mi and the inverses vi just once, expecting many future computations with different residue sets {ni}. In fact, one may precompute the products viMi. A computer with r parallel nodes can then reconstruct niviMi in O(ln r) steps. There are other ways to organize the CRT data, such as building up one partial modulus at a time. One such method is the Garner algorithm [Menezes et al. 1997], which can also be done with preconditioning. Algorithm 2.1.7 (CRT reconstruction with preconditioning (Garner)). Using the nomenclature of Theorem 2.1.6, we assume r ≥ 2 fixed, pairwise coprime moduli m0,...,mr−1 whose product is M, and a set of given residues {ni (mod mi)}. This algorithm returns the unique n ∈ [0,M− 1] with the given residues. After the precomputation step, the algorithm may be reentered for future evaluations of such n (with the {mi} remaining fixed). 1. [Precomputation] for(1 ≤ i
2.2 Polynomial arithmetic 89 is used for repeated CRT calculations, one can perform [Precomputation] for Algorithm 2.1.7 just once, store an appropriate set of r − 1 integers, and allow efficient reentry. In Section 9.5.9 we describe a CRT reconstruction algorithm that not only takes advantage of preconditioning, but of fast methods to multiply integers. 2.2 Polynomial arithmetic Many of the algorithms for modular arithmetic have almost perfect analogues in the polynomial arena. 2.2.1 Greatest common divisor for polynomials We next give algorithms for polynomials analogous to the Euclid forms in Section 2.1.1 for integer gcd and inverse. When we talk about polynomials, thefirstissueiswherethecoefficientscomefrom.Wemaybedealingwith Q[x], the polynomials with rational coefficients, or Zp[x], polynomials with coefficients in the finite field Zp. Or from some other field. We may also be dealing with polynomials with coefficients drawn from a ring that is not a field,aswedowhenweconsiderZ[x] orZn[x] withn not a prime. Because of the ambiguity of the arena in which we are to work, perhaps it is better to go back to first principles and begin with the more primitive concept of divide with remainder. If we are dealing with polynomials in F [x], where F is a field, there is a division theorem completely analogous to the situation with ordinary integers. Namely, if f(x),g(x) areinF [x] withf not the zero polynomial, then there are (unique) polynomials q(x),r(x) inF [x] with g(x) =q(x)f(x)+r(x) and either r(x) =0or degr(x) < deg f(x). (2.4) Moreover, we can use the “grammar-school” method of building up the quotient q(x) term by term to find q(x) and r(x). Thinking about this method, one sees that the only special property of fields that is used that is not enjoyed by a general commutative ring is that the leading coefficient of the divisor polynomial f(x) is invertible. So if we are in the more general case of polynomials in R[x] whereR is a commutative ring with identity, we can perform a divide with remainder if the leading coefficient of the divisor polynomial is a unit, that is, it has a multiplicative inverse in the ring. For example, say we wish to divide 3x +2intox 2 in the polynomial ring Z10[x]. The inverse of 3 in Z10 (which can be found by Algorithm 2.1.4) is 7. We get the quotient 7x + 2 and remainder 6. In sum, if f(x),g(x) areinR[x], where R is a commutative ring with identity and the leading coefficient of f is a unit in R, then there are unique polynomials q(x),r(x) inR[x] such that (2.4) holds. We use the notation r(x) = g(x) modf(x). For much more on polynomial remaindering, see Section 9.6.2.
- Page 52 and 53: 38 Chapter 1 PRIMES! conjectured. T
- Page 54 and 55: 40 Chapter 1 PRIMES! Definition 1.4
- Page 56 and 57: 42 Chapter 1 PRIMES! on the left co
- Page 58 and 59: 44 Chapter 1 PRIMES! sums. These su
- Page 60 and 61: 46 Chapter 1 PRIMES! Vinogradov’s
- Page 62 and 63: 48 Chapter 1 PRIMES! been beyond re
- Page 64 and 65: 50 Chapter 1 PRIMES! prime? What is
- Page 66 and 67: 52 Chapter 1 PRIMES! This kind of c
- Page 68 and 69: 54 Chapter 1 PRIMES! where p runs o
- Page 70 and 71: 56 Chapter 1 PRIMES! While the prim
- Page 72 and 73: 58 Chapter 1 PRIMES! Exercise 1.35.
- Page 74 and 75: 60 Chapter 1 PRIMES! this recreatio
- Page 76 and 77: 62 Chapter 1 PRIMES! so that A3(x)
- Page 78 and 79: 64 Chapter 1 PRIMES! Conclude that
- Page 80 and 81: 66 Chapter 1 PRIMES! implies that
- Page 82 and 83: 68 Chapter 1 PRIMES! the Riemann-Si
- Page 84 and 85: 70 Chapter 1 PRIMES! such sums can
- Page 86 and 87: 72 Chapter 1 PRIMES! Cast this sing
- Page 88 and 89: 74 Chapter 1 PRIMES! 10 10 . The me
- Page 90 and 91: 76 Chapter 1 PRIMES! These numbers
- Page 92 and 93: 78 Chapter 1 PRIMES! Next, as for q
- Page 94 and 95: 80 Chapter 1 PRIMES! (see [Bach 199
- Page 96 and 97: 82 Chapter 1 PRIMES! If one invokes
- Page 98 and 99: 84 Chapter 2 NUMBER-THEORETICAL TOO
- Page 100 and 101: 86 Chapter 2 NUMBER-THEORETICAL TOO
- Page 104 and 105: 90 Chapter 2 NUMBER-THEORETICAL TOO
- Page 106 and 107: 92 Chapter 2 NUMBER-THEORETICAL TOO
- Page 108 and 109: 94 Chapter 2 NUMBER-THEORETICAL TOO
- Page 110 and 111: 96 Chapter 2 NUMBER-THEORETICAL TOO
- Page 112 and 113: 98 Chapter 2 NUMBER-THEORETICAL TOO
- Page 114 and 115: 100 Chapter 2 NUMBER-THEORETICAL TO
- Page 116 and 117: 102 Chapter 2 NUMBER-THEORETICAL TO
- Page 118 and 119: 104 Chapter 2 NUMBER-THEORETICAL TO
- Page 120 and 121: 106 Chapter 2 NUMBER-THEORETICAL TO
- Page 122 and 123: 108 Chapter 2 NUMBER-THEORETICAL TO
- Page 124 and 125: 110 Chapter 2 NUMBER-THEORETICAL TO
- Page 126 and 127: 112 Chapter 2 NUMBER-THEORETICAL TO
- Page 128 and 129: 114 Chapter 2 NUMBER-THEORETICAL TO
- Page 130 and 131: Chapter 3 RECOGNIZING PRIMES AND CO
- Page 132 and 133: 3.1 Trial division 119 d =3; while(
- Page 134 and 135: 3.2 Sieving 121 3.2 Sieving Sieving
- Page 136 and 137: 3.2 Sieving 123 this number’s ent
- Page 138 and 139: 3.2 Sieving 125 noticed that it was
- Page 140 and 141: 3.2 Sieving 127 } S = S \ (pS ∩ [
- Page 142 and 143: 3.3 Recognizing smooth numbers 129
- Page 144 and 145: 3.4 Pseudoprimes 131 } g =gcd(s, x)
- Page 146 and 147: 3.4 Pseudoprimes 133 Theorem 3.4.4.
- Page 148 and 149: 3.5 Probable primes and witnesses 1
- Page 150 and 151: 3.5 Probable primes and witnesses 1
2.2 Polynomial arithmetic 89<br />
is used for repeated CRT calculations, one can perform [Precomputation] for<br />
Algorithm 2.1.7 just once, store an appropriate set of r − 1 integers, and allow<br />
efficient reentry.<br />
In Section 9.5.9 we describe a CRT reconstruction algorithm that not only<br />
takes advantage of preconditioning, but of fast methods to multiply integers.<br />
2.2 Polynomial arithmetic<br />
Many of the algorithms for modular arithmetic have almost perfect analogues<br />
in the polynomial arena.<br />
2.2.1 Greatest common divisor for polynomials<br />
We next give algorithms for polynomials analogous to the Euclid forms in<br />
Section 2.1.1 for integer gcd and inverse. When we talk about polynomials,<br />
thefirstissueiswherethecoefficientscomefrom.Wemaybedealingwith<br />
Q[x], the polynomials with rational coefficients, or Zp[x], polynomials with<br />
coefficients in the finite field Zp. Or from some other field. We may also be<br />
dealing with polynomials with coefficients drawn from a ring that is not a<br />
field,aswedowhenweconsiderZ[x] orZn[x] withn not a prime.<br />
Because of the ambiguity of the arena in which we are to work, perhaps<br />
it is better to go back to first principles and begin with the more primitive<br />
concept of divide with remainder. If we are dealing with polynomials in F [x],<br />
where F is a field, there is a division theorem completely analogous to the<br />
situation with ordinary integers. Namely, if f(x),g(x) areinF [x] withf not<br />
the zero polynomial, then there are (unique) polynomials q(x),r(x) inF [x]<br />
with<br />
g(x) =q(x)f(x)+r(x) and either r(x) =0or degr(x) < deg f(x). (2.4)<br />
Moreover, we can use the “grammar-school” method of building up the<br />
quotient q(x) term by term to find q(x) and r(x). Thinking about this<br />
method, one sees that the only special property of fields that is used that<br />
is not enjoyed by a general commutative ring is that the leading coefficient<br />
of the divisor polynomial f(x) is invertible. So if we are in the more general<br />
case of polynomials in R[x] whereR is a commutative ring with identity, we<br />
can perform a divide with remainder if the leading coefficient of the divisor<br />
polynomial is a unit, that is, it has a multiplicative inverse in the ring.<br />
For example, say we wish to divide 3x +2intox 2 in the polynomial ring<br />
Z10[x]. The inverse of 3 in Z10 (which can be found by Algorithm 2.1.4) is 7.<br />
We get the quotient 7x + 2 and remainder 6.<br />
In sum, if f(x),g(x) areinR[x], where R is a commutative ring with<br />
identity and the leading coefficient of f is a unit in R, then there are unique<br />
polynomials q(x),r(x) inR[x] such that (2.4) holds. We use the notation<br />
r(x) = g(x) modf(x). For much more on polynomial remaindering, see<br />
Section 9.6.2.