| |
| | Fast implementation of the segmented sieve of Eratosthenes |
 | | The first term is related to the number of expected multiples of the sieving primes belonging to [P,Q], and the second is related to the overhead incurred in the computation of the first multiple, not smaller than P, of each sieving prime. |
 | | To do this, the first multiple (belonging to the interval being sieved) of each sieving prime is computed, the subinterval where this multiple lies is identified, and the prime and respective multiple are placed in the appropriate list. |
 | | Simple implementation [12k, gziped tar archive] of the segmented sieve of Eratosthenes, released under the version 2 (or any later version) of the GNU general public license. |
| www.ieeta.pt /~tos/software/prime_sieve.html (1054 words) |
|