|Resources in programs : sieves : Eratosthenes : C source code|
C-code by Frank Pilhofer
- The author says "My implementation..is not only fast but also saves memory, and its macros are almost completely ununderstandable."
(Added: 3-Aug-2000 Hits: 24881 Rating: 7.48 Votes: 23) Rate It
Robert Bennion's Hopping Sieve
- "The hopping sieve" was developed by Robert Bennion at the University of Utah in the early 1970s. This sieve MAY have advantages over other methods if you have a small or slow cache memory.
This page contains links and C source code.
(Added: 3-Aug-2000 Hits: 10744 Rating: 3.50 Votes: 2) Rate It
A compact prime sieve
- 52 lines of portable ANSI C.
Outputs roughly first and last sqrt(N)
primes when searching primes up to N
(rounded up to next multiple of 30),
and finally reports #primes found.
cc -O sieve.c -o sieve
As an indication of speed, my
AMD Athlon(tm) XP 2700+ PC computes
all primes up to 10^9 in 12 seconds.
(Added: 4-Nov-2004 Hits: 7100 Rating: 6.67 Votes: 6) Rate It
Cache-friendly fast segmented sieve of Eratosthenes
- Fast generation of primes in a given interval. Works with 64-bit integers. Should be compiled with the gcc compiler. Works with 64-bit integers. Works quite fast near 1e16 or higher (but uses a lot of memory...).
(Added: 3-Feb-2003 Hits: 6839 Rating: 7.14 Votes: 7) Rate It
Sieb des Eratosthenes (EcprimeV1.4)
(Added: 5-Jul-2005 Hits: 2653 Rating: 7.60 Votes: 5) Rate It
The Art of Prime Sieving
(Added: 5-Jul-2005 Hits: 5497 Rating: 8.57 Votes: 7) Rate It