0

This is a translation to C# of a Modula-2 implementation by N.Wirth, the inventor of Pascal. The tested integers are obtained by incrementing alternatively by 2 and 4, thereby avoiding multiples of 2 and 3 in the first place. This list starts with 5, assuming 2 and 3 are already known primes. Divisibility needs to be tested for prime divisors only, which are obtained by storing previously computed results. This algorithm is a little bit hazier then the traditional "sieve" algorithm. But it is fun to play computer yourself and figure out how it works!