| 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."
pop
(Added: 3-Aug-2000 Hits: 20249 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.
pop
(Added: 3-Aug-2000 Hits: 9179 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.
Compile with
cc -O sieve.c -o sieve
usage: ./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: 5008 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: 5337 Rating: 7.14 Votes: 7) Rate It
-
Sieb des Eratosthenes (EcprimeV1.4)
(Added: 5-Jul-2005 Hits: 1686 Rating: 6.00 Votes: 3) Rate It
-
The Art of Prime Sieving
(Added: 5-Jul-2005 Hits: 3591 Rating: 9.83 Votes: 6) Rate It
| |