Implementing “Sieve of Eratosthenes” in Python

For a couple of days, I’ve gathered a lot of information about prime numbers and algorithms which generates them. out of all the available algorithms, “Sieve of Eratosthenes” is one of the most normally used ones and i want to implement this algorithm in python. After an hour of battle with the Python, i successfully tamed it.  The scriptgenerates all the prime numbers within the range of 2 and the number scanned from the user. The script will be available at

(image from wikipedia)

This entry was posted in Algorithms, Python. Bookmark the permalink.

3 Responses to Implementing “Sieve of Eratosthenes” in Python

  1. Narasimhan V says:

    Really gud diagrammatic representation of the algo!! 🙂

  2. Harsh says:

    Great work! Now attempt the Atkin’s sieve. It isn’t as complex as it may seem initially, and will give your CPU good stuff to savor.

  3. Prasad says:

    very good work.. keep it up..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s