09.12.2012 Views

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

442 ASYMPTOTICS<br />

Problem 3: The nth prime number.<br />

Equation (9.31) is an asymptotic <strong>for</strong>mula <strong>for</strong> n(n), the number of primes<br />

that do not exceed n. If we replace n by p = P,,, the nth prime number, we<br />

have n(p) = n; hence<br />

as n + 00. Let us try to “solve” this equation <strong>for</strong> p; then we will know the<br />

approximate size of the nth prime.<br />

The first step is to simplify the 0 term. If we divide both sides by p/lnp,<br />

we find that nlnp/p + 1; hence p/lnp = O(n) and<br />

O(&) = o(i&J = “(&I*<br />

(We have (logp))’ < (logn))’ because p 3 n.)<br />

The second step is to transpose the two sides of (g.42), except <strong>for</strong> the<br />

0 term. This is legal because of the general rule<br />

an= b, +O(f(n)) # b, = a,, +O(f(n)) . (9.43)<br />

(Each of these equations follows from the other if we multiply both sides<br />

by -1 and then add a, + b, to both sides.) Hence<br />

P<br />

- = n+O(&) = n(1 +O(l/logn)) ,<br />

lnp<br />

and we have<br />

p = nlnp(1 + O(l/logn)) . (9.44)<br />

This is an “approximate recurrence” <strong>for</strong> p = P, in terms of itself. Our goal<br />

is to change it into an “approximate closed <strong>for</strong>m,” and we can do this by<br />

unfolding the recurrence asymptotically. So let’s try to unfold (9.44).<br />

By taking logarithms of both sides we deduce that<br />

lnp = lnn+lnlnp + O(l/logn) , (9.45)<br />

This value can be substituted <strong>for</strong> lnp in (g.&, but we would like to get rid<br />

of all p’s on the right be<strong>for</strong>e making the substitution. Somewhere along the<br />

line, that last p must disappear; we can’t get rid of it in the normal way <strong>for</strong><br />

recurrences, because (9.44) doesn’t specify initial conditions <strong>for</strong> small p.<br />

One way to do the job is to start by proving the weaker result p = O(n2).<br />

This follows if we square (9.44) and divide by pn2,<br />

P (lnp12<br />

= ~ 1 + O(l/logn)) ,<br />

7 P (

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

Saved successfully!

Ooh no, something went wrong!