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!
- Link to Programming Challenge Twenty Calculate which numbers up to 5 million are prime.
- Link to Programming Challenge Nineteen Fill a board with the same digit


No comments yet. Leave a Comment