Python Prime Number Sieves

sanghan
1,823 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
Next: Algorithm

Prime Sieves and Python Data Structures

One of those recurring problems requires efficiently calculating and testing for prime numbers. The first algorithm that comes to mind is The Sieve of Eratosthenes.

The Sieve, is one of many prime sieves, and is a simple yet time efficient algorithm for finding all the primes below a certain limit.

A prime number is a natural number that has exactly two distinct natural number divisors: 1 and itself. Make note that we do not consider 1 a prime number albeit also not being composite.

Is 2 a prime number
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content