Sieve of Eratosthenes - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Math Apps : Discrete Mathematics : Sieve of Eratosthenes

Sieve of Eratosthenes

Main Concept

• 

A prime number is a natural number greater than 1 that has no positive factor other than 1 and itself.

• 

A composite number is a natural number greater than 1 that has at least one factor other than 1 and itself, in other words, is not prime.

 

Eratosthenes' Method of Finding Prime Numbers:

1. 

Consider a grid of consecutive integers ranging from 2 to n; we exclude 1 from the grid because it is neither a prime nor composite number.

2. 

Let p be the first prime number, 2.

3. 

Mark off its multiples (pp,  pp+1,  pp+2....) ranging from p2 to n as composite numbers (mark p itself as prime).

4. 

Take p to be the next unmarked number on the grid, mark it as prime and mark all of its multiples ranging from p2 to n as composite numbers.**

5. 

Repeat step 4 until there are no more unmarked numbers in the grid less than or equal to n.  For example, while  p  n.

6. 

Mark the remaining unmarked numbers in the grid greater than n as prime numbers.

 

**Note : Multiples less than p2 can be disregarded because these numbers will have been marked off as multiples of lower primes. For example, when marking off the multiples of 5, the numbers 10, 15 and 20 will already have been marked off as multiples of 2, 3 and 2 respectively. We thus starting marking with 52 = 25.

Explore by changing the number of rows and columns. A grid of consecutive integers ranging from 2 to n, where n equals the the number of rows multiplied by the number of columns, will be generated.

 

     

 

   Number of Rows          :               

   Number of Columns     :               

   Speed                          : 

More MathApps

Math/Apps/DiscreteMathematics