Prime Numbers

Prime Numbers Prime Numbers

thales.doa.fmph.uniba.sk
from thales.doa.fmph.uniba.sk More from this publisher
10.12.2012 Views

3.7 Counting primes 153 Label the consecutive primes p1,p2,p3,...,wherep1 =2,p2 =3,p3 =5, etc. Let φ(x, y) =#{1 ≤ n ≤ x : each prime dividing n is greater than y}. Thus φ(x, pa) is the number of integers left unmarked in the sieve of Eratosthenes, applied to the interval [1,x], after sieving with p1,p2,...,pa. Since sieving up to √ x leaves only the number 1 and the primes in ( √ x, x], we have π(x) − π √ x +1=φ x, √ x . One could easily use this idea to compute π(x), the time taking O(x ln ln x) operations and, if the sieve is segmented, taking O x 1/2 ln x space. (We shall begin suppressing ln x and ln ln x factors for simplicity, sweeping them under a rather large rug of O(x ɛ ). It will be clear that each x ɛ could be replaced, with a little more work, with a small power of logarithm and/or double logarithm.) A key thought is that the sieve not only allows us to count the primes, it also identifies them. If it is only the count we are after, then perhaps we can be speedier. We shall partition the numbers counted by φ(x, y) by the number of prime factors they have, counted with multiplicity. Let φk(x, y) =#{n ≤ x : n has exactly k prime factors, each exceeding y}. Thus, if x ≥ 1, φ0(x, y) is1,φ1(x, y) is the number of primes in (y, x], φ2(x, y) is the number of numbers pq ≤ x where p, q areprimeswithy

154 Chapter 3 RECOGNIZING PRIMES AND COMPOSITES allowed to run over the interval [p, x/p], and so the number of choices for q is π(x/p) − π(p) + 1. Thus, φ2(x, x 1/3 )= (π(x/p) − π(p)+1) The last sum is = π(x 1/3 )

3.7 Counting primes 153<br />

Label the consecutive primes p1,p2,p3,...,wherep1 =2,p2 =3,p3 =5,<br />

etc. Let<br />

φ(x, y) =#{1 ≤ n ≤ x : each prime dividing n is greater than y}.<br />

Thus φ(x, pa) is the number of integers left unmarked in the sieve of<br />

Eratosthenes, applied to the interval [1,x], after sieving with p1,p2,...,pa.<br />

Since sieving up to √ x leaves only the number 1 and the primes in ( √ x, x],<br />

we have<br />

π(x) − π √ x +1=φ x, √ x .<br />

One could easily use this idea to compute π(x), the time taking O(x ln ln x)<br />

operations and, if the sieve is segmented, taking O x 1/2 ln x space. (We shall<br />

begin suppressing ln x and ln ln x factors for simplicity, sweeping them under a<br />

rather large rug of O(x ɛ ). It will be clear that each x ɛ could be replaced, with<br />

a little more work, with a small power of logarithm and/or double logarithm.)<br />

A key thought is that the sieve not only allows us to count the primes, it<br />

also identifies them. If it is only the count we are after, then perhaps we can<br />

be speedier.<br />

We shall partition the numbers counted by φ(x, y) by the number of prime<br />

factors they have, counted with multiplicity. Let<br />

φk(x, y) =#{n ≤ x : n has exactly k prime factors, each exceeding y}.<br />

Thus, if x ≥ 1, φ0(x, y) is1,φ1(x, y) is the number of primes in (y, x], φ2(x, y)<br />

is the number of numbers pq ≤ x where p, q areprimeswithy

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

Saved successfully!

Ooh no, something went wrong!