Top "Sieve-of-eratosthenes" questions

Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to a specified integer.

Speed up bitstring/bit operations in Python?

I wrote a prime number generator using Sieve of Eratosthenes and Python 3.1. The code runs correctly and gracefully at 0.32 seconds …

python-3.x optimization bit-manipulation primes sieve-of-eratosthenes
Factorizing a number in Python

Here's my code: def factorize(n): sieve = [True] * (n + 1) for x in range(2, int(len(sieve) ** 0.5) + 1): if sieve[x]: for …

python loops primes prime-factoring sieve-of-eratosthenes
Sieve of Eratosthenes

I read up on the sieve of Eratosthenes while solving a question on Project Euler. I'm sure you guys know …

c sieve-of-eratosthenes sieve
Prime Sieve in Haskell

I'm very new to Haskell and I'm just trying to find the sum of the first 2 million primes. I'm trying …

haskell primes sieve-of-eratosthenes
Finding Primes with Modulo in Python

I have been sweating over this piece of code -- which returns all the primes in a list: primes = range(2, 20) …

python lambda primes modulus sieve-of-eratosthenes
Scala: iterate a sequence while modifying it?

I'm trying to implement the Sieve of Eratosthenes in Scala. I start by initializing a sequence of all odd numbers …

scala functional-programming iterator sieve-of-eratosthenes