Discrete Mathematics/Sieve of Eratosthenes

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

The Sieve of Eratosthenes is a w:prime number finding method of w:factorial elimination. The method involves selecting a w:domain and proceeding from the initial member to remove from the set any numbers which are multiples of the initial member. The remaining numbers in the resultant w:subset are the prime numbers from the initial w:superset Example: The domain 2-10

2, 3, 4, 5, 6, 7, 8, 9, 10
2, 3, 4, 5, 6, 7, 8, 9, 10 remove multiples of '2'
2, 3, 4, 5, 6, 7, 8, 9, 10 remove multiples of '3'
2, 3, 4, 5, 6, 7, 8, 9, 10 remove multiples of '5'
2, 3, 4, 5, 6, 7, 8, 9, 10 remove multiples of '7'

With the resultant set: {2, 3, 5, 7}, just the primes.