1. Home
  2. Computing & Technology
  3. C / C++ / C#
photo of David Bolton
David's C / C++ / C# Blog

By David Bolton, About.com Guide to C / C++ / C#

Programming Challenge 20 - Sieve of Erathostenes

Monday December 15, 2008
This is a technique for working out if an integer is prime, i.e. can't be divided cleanly by any number except itself and 1. 2 is prime but no other even number is. 3, 5 and 7 are prime but 9 isn't as it can be divided by 3 and so on. The sieve basically removes all numbers divisible by 3, then 5 then 11, 13 etc.

Your task is to implement this sieve algorithm to run as fast as possible in code. So a nice simple challenge that starts from January 1 2009. In the meanwhile there's still over two weeks for Challenge 19 and we've had some entries already!

Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2009 About.com, a part of The New York Times Company.

All rights reserved.