Tom Moran wrote:
> The idea is straightforward: Create a boolean array with True for each
> potential prime from 2 .. N. Then take each known prime in turn (2 is a
> known prime) and mark all its multiples as False (not prime). The ones
> left True when you are done are not divisibly by any number less than
> themselves (except 1 of course) so they must be primes. It's pretty
> straightforward to code.
There's also a solution that is difficult to code, except in Ada:
Numbers are passed from task to task. Each task holds a prime and passes
numbers that are not multiples of that prime. If a number gets past the
last task, a new task is created for that number. Initially there is a
single task, holding 2.
--
Jeff Carter
"You tiny-brained wipers of other people's bottoms!"
Monty Python & the Holy Grail