10.12.2012 Views

Prime Numbers

Prime Numbers

Prime Numbers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

496 Chapter 9 FAST ALGORITHMS FOR LARGE-INTEGER ARITHMETIC<br />

}<br />

carry = ⌊v/B⌋;<br />

8. [Final modular adjustment]<br />

Include possible carry > 0 as a high digit of z;<br />

z = z mod Fn;<br />

// Via another ’carry’ loop or via special-form mod methods.<br />

return z;<br />

Note that in the steps [Adjust carry in base B] and [Final modular<br />

adjustment] the logic depends on the digits of the reconstructed integer z<br />

being positive. We say this because there are efficient variants using balanceddigit<br />

representation, in which variants care must be taken to interpret negative<br />

digits (and negative carry) correctly.<br />

This algorithm was used in the discoveries of new factors of F13,F15,F16,<br />

and F18 [Brent et al. 2000] (see the Fermat factor tabulation in Section<br />

1.3.2), and also to establish the composite character of F22, F24, and of<br />

various cofactors for other Fn [Crandall et al. 1995], [Crandall et al. 1999]. In<br />

more recent times, [Woltman 2000] has implemented the algorithm to forge<br />

highly efficient factoring software for Fermat numbers (see remarks following<br />

Algorithm 7.4.4).<br />

Another DWT variant has been used in the discovery of eight Mersenne<br />

primes 2 1398269 −1, 2 2976221 −1, 2 3021377 −1, 2 6972593 −1, 2 13466917 −1, 2 20996011 −<br />

1, 2 24036583 −1, 2 25964951 −1 (see Table 1.2), the last of which being the largest<br />

known explicit prime as of the present writing. For these discoveries, a network<br />

of volunteer users ran extensive Lucas–Lehmer tests that involve vast numbers<br />

of squarings modulo p =2 q − 1. The algorithm variant in question has been<br />

called the irrational-base discrete weighted transform (IBDWT) [Crandall and<br />

Fagin 1994], [Crandall 1996a] for the reason that a special digit representation<br />

reminiscent of irrational-base expansion is used, which representation amounts<br />

to a discrete rendition of an attempt to expand in an irrational base. Let<br />

p =2 q − 1 and observe first that if an integer x be represented in base B =2<br />

as<br />

q−1<br />

x = xj2 j ,<br />

j=0<br />

equivalently, x is the length-q signal (xj); and similarly for an integer y, then<br />

the cyclic convolution x×y has, without carry, the digits of (xy) modp. Thus,<br />

in principle, the standard FFT multiply could be effected in this way, modulo<br />

Mersenne primes, without zero-padding. However, there are two problems with<br />

this approach. First, the arithmetic is merely bitwise, not exploiting typical<br />

machine advantages of word arithmetic. Second, one would have to invoke a<br />

length-q FFT. This can certainly be done (see Exercises), but power-of-two<br />

lengths are usually more efficient, definitely more prevalent.<br />

It turns out that both of the obstacles to a not-zero-padded Mersenne<br />

multiply-mod can be overcome, if only we could somehow represent integers<br />

x in the irrational base B =2 q/D ,with1

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

Saved successfully!

Ooh no, something went wrong!