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.

9.7 Exercises 521<br />

where “do” simply means one repeats what is in the braces for some<br />

appropriate total iteration count. Note that the duplication of the y iteration<br />

is<br />

√<br />

intentional! Show that this scheme formally generates the binomial series of<br />

1+a via the variable x. How many correct terms obtain after k iterations<br />

of the do loop?<br />

Next, calculate some real-valued square roots in this way, noting the<br />

important restriction that |a| cannot be too large, lest divergence occur (the<br />

formal correctness of the resulting series in powers of a does not, of course,<br />

automatically guarantee convergence).<br />

Then, consider this question: Can one use these ideas to create an<br />

algorithm for extracting integer square roots? This could be a replacement<br />

for Algorithm 9.2.11; the latter, we note, does involve explicit division. On<br />

this question it may be helpful to consider, for given n to be square-rooted,<br />

such as n/4q =2−q√n or some similar construct, to keep convergence under<br />

control.<br />

Incidentally, it is of interest that the standard, real-domain, Newton<br />

iteration for the inverse square root automatically has division-free form,<br />

yet we appear to be compelled to invoke such as the above coupled-variable<br />

expedient for a positive fractional power.<br />

9.15. The Cullen numbers are Cn = n2 n +1. Write a Montgomery powering<br />

program specifically tailored to find composite Cullen numbers, via relations<br />

such as 2 Cn−1 ≡ 1(modCn). For example, within the powering algorithm<br />

for modulus N = C245 you would be taking say R =2 253 so that R>N.<br />

You could observe, for example, that C141 is a base-2 pseudoprime in this way<br />

(it is actually a prime). A much larger example of a Cullen prime is Wilfrid<br />

Keller’s C18496. For more on Cullen numbers see Exercise 1.83.<br />

9.16. Say that we wish to evaluate 1/3 using the Newton reciprocation of<br />

the text (among real numbers, so that the result will be 0.3333 ...). For initial<br />

guess x0 =1/2, prove that for positive n the n-th iterate xn is in fact<br />

xn = 22n<br />

− 1<br />

3 · 22n ,<br />

in this way revealing the quadratic-convergence property of a successful<br />

Newton loop. The fact that a closed-form expression can even be given for the<br />

Newton iterates is interesting in itself. Such closed forms are rare—can you<br />

find any others?<br />

9.17. Work out the asymptotic complexity of Algorithm 9.2.8, in terms of<br />

a size-N multiply, and assuming all the shifting enhancements discussed in<br />

the text. Then give the asymptotic complexity of the composite operation<br />

(xy) modN, for 0 ≤ x, y < N, in the case that the generalized reciprocal is not<br />

yet known. What is the complexity for (xy) modN if the reciprocal is known?<br />

(This should be asymptotically the same as the composite Montgomery<br />

operation (xy) modN if one ignores the precomputations attendant to the<br />

latter.) Incidentally, in actual programs that invoke the Newton–Barrett ideas,

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

Saved successfully!

Ooh no, something went wrong!