# Lecture: Unique factorization, 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)
• Maple's isprime and ifactor commands.

• Chapter sections 3.4.1 and 3.7 of the text (only a small part of these sections will be covered in this lecture).

### Topics

• Sieve of Eratosthenes
• Prime number theorem
• Trial division
• Unique factorization
• Generating large random prime numbers

### Maple worksheets and other resources

• sieve.mw - Maple worksheet for this lecture.
Created: April 8, 2008 (revised May 7, 2013) by jjohnson AT cs DOT drexel DOT edu