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.

9.2 Enhancements to modular arithmetic 453<br />

where b = B(R) − 1. In particular, such splitting can render the relevant<br />

multiplications somewhat simpler. In fact, one sees that<br />

R x/2 b−1 /2 b+1 = ⌊x/N⌋−j (9.13)<br />

for j =0, 1, or 2. Thus using the left-hand side for d in Algorithm 9.2.10<br />

involves at most two passes through the while loop. And there is an apparent<br />

savings in time, since the length of x can be about 2b, and the length of R<br />

about b. Thus the multiplication xR in Algorithm 9.2.10 is about 2b × b<br />

bits, while the multiplication inherent in (9.12) is only about b × b bits.<br />

Because a certain number of the bits of xR are destined to be shifted into<br />

oblivion (a shift completely obscures the relevant number of lower-order bits),<br />

one can intervene into the usual grammar-school multiply loop, effectively<br />

cutting the aforementioned rhombus into a smaller tableau of values. With<br />

considerations like this, it can be shown that for 0 ≤ x

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

Saved successfully!

Ooh no, something went wrong!