Lecture 3: The Sieve of Eratosthenes and the Prime Number Theorem
This lecture discusses a simple way to generate a table of prime numbers.
The table can then be used the count the number of primes less than a given
number. The number of primes less than N, pi(N), is approximately N/log(N),
which implies that the probability that a random number chosen uniformly
between 2 and N is prime is approximately 1/log(N), where log(N) is the
natural log. Given a table of primes upto N, one can determine the primality
of a number less than or equal to N^2 through trial division of the primes
in the table. Alternatively all numbers upto the square root of the given
number can be tested. This approach, called trial division, is very slow
except for small numbers. In a similar fashion a number can be factored.
This approach can quickly find small factors, but can not feasibly find larger
factors.
Background Material
- Simple Maple programming (loops, conditionals, procedures, arrays) -
See Maple documentation and resources and worksheets from
Reading
- Chapter sections 2.1-2.3 of the text.
Also study Maple's isprime and ifactor commands.
Topics
- Sieve of Eratosthenes
- Trial division
Maple worksheets and other resources
- sieve.mw - Maple worksheet for this lecture.
Created: April 8, 2008 by jjohnson AT cs DOT drexel DOT edu