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:
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.
Let p be the first prime number, 2.
Mark off its multiples (pp, pp+1, pp+2....) ranging from p2 to n as composite numbers (mark p itself as prime).
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.**
Repeat step 4 until there are no more unmarked numbers in the grid less than or equal to n. For example, while p ≤ n.
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 : 5678910111213141516171819202122232425
Number of Columns : 5678910111213141516171819202122232425
Speed : SlowestSlowMediumFastFastest
More MathApps
Math/Apps/DiscreteMathematics
Download Help Document