| |
| | sieve of Eratosthenes |
 | | Definition: An algorithm to find all prime numbers up to a certain N. Begin with an (unmarked) array of integers from 2 to N. The first unmarked integer, 2, is the first prime. |
 | | The next unmarked integer is 3, so it is prime, and we mark every third integer, i.e., 6, 9, 12, etc. Note that we mark 6, 12, 18, etc. again. |
 | | To optimize, when we find the prime n, we can begin marking at n², since any composite less than that is a multiple of a lesser prime, and so will have been marked earlier. |
| www.nist.gov /dads/HTML/sieve.html (312 words) |
|