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.

6.1 The quadratic sieve factorization method 267<br />

(2) To do the sieving, one must know which residue classes to sieve for each pi<br />

found in Step [Initialization]. (For simplicity, we shall ignore the problem<br />

of sieving with higher powers of these primes. Such sieving is easy to do—<br />

one can use Algorithm 2.3.11, for example—but might also be ignored in<br />

practice, since it does not contribute much to the finding of B-smooth<br />

numbers.) For the odd primes pi in Step [Initialization], we have solved<br />

the congruence x 2 ≡ n (mod pi). This is solvable, since the pi’s have<br />

been selected in Step [Initialization] precisely to have this property. Either<br />

Algorithm 2.3.8 or Algorithm 2.3.9 may be used to solve the congruence.<br />

Of course, for each solution, we also have the negative of this residue class<br />

as a second solution, so we sieve two residue classes for each pi with pi odd.<br />

(Though we could sieve with p1 = 2 as indicated in the pseudocode, we<br />

do not have to sieve at all with 2 and other small primes; see the remarks<br />

in Section 3.2.5.)<br />

(3) An important point is that the arithmetic involved in the actual sieving<br />

can be done through additions of approximate logarithms of the primes<br />

being sieved, as discussed in Section 3.2.5. In particular, one should set up<br />

a zero-initialized array of some convenient count of b bytes, corresponding<br />

to the first b of the x values. Then one adds a lg pi increment (rounded<br />

to the nearest integer) starting at offsets xi,x ′ i , the least integers ≥⌈√ n⌉<br />

that are congruent (mod pi) toai, −ai, respectively, and at every spacing<br />

pi from there forward in the array. If necessary (i.e., not enough smooth<br />

numbers have been found) a new array is zeroed with its first element<br />

corresponding to ⌈ √ n⌉+b, and continue in the same fashion. The threshold<br />

set for reporting a location with a B-smooth value is set as lg |x 2 − n| ,<br />

minus some considerable fudge, such as 20, to make up for the errors in<br />

the approximate logarithms, and other errors that might accrue from not<br />

sieving with small primes or higher powers. Any value reported must be<br />

tested by trial division to see if it is indeed B-smooth. This factorization<br />

plays a role in step [Linear algebra]. (To get an implementation working<br />

properly, it helps to test the logarithmic array entries against actual, hard<br />

factorizations.)<br />

(4) Instead of starting at ⌈ √ n⌉ and running up through the integers, consider<br />

instead the possibility of x running through a sequence of integers centered<br />

at √ n. There is an advantage and a disadvantage to this thought. The<br />

advantage is that the values of the polynomial x 2 − n are now somewhat<br />

smaller on average, and so presumably they are more likely to be Bsmooth.<br />

The disadvantage is that some values are now negative, and the<br />

sign is an important consideration when forming squares. Squares not<br />

only have all their prime factors appearing with even exponents, they are<br />

also positive. This disadvantage can be handled very simply. We enlarge<br />

the exponent vectors by one coordinate, letting the new coordinate, say<br />

the zeroth one, be 1 if the integer is negative and 0 if it is positive. So,<br />

just like all of the other coordinates, we wish to get an even number<br />

of 1’s. This has the effect of raising the dimension of our vector space

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

Saved successfully!

Ooh no, something went wrong!