The Prime Links++ Links related to Prime Numbers
[ Add | Update | New | Popular ]
Historically, the most efficient way to find all of the small primes (say all those less than 10,000,000) is by using the Sieve of Eratosthenes(ca 240 BC):
Make a list of all the integers less than or equal to n (and greater than one). Strike out the multiples of all primes less than or equal to the square root of n, then the numbers that are left are the primes.
For an example (as well as additional information and pseudocode), see the Prime Glossary's entry on the sieve of Eratosthenes .

The article [Pritchard87] offers comparisons of various sieves. Below we offer a list of implementations of the sieve without any such comparisons (in fact, I've not even tried most of these out).

Top : programs : sieves : Eratosthenes
Categories in programs : sieves : Eratosthenes
C source code (6)
Source code to implement the sieve of Eratosthenes in C code (any version of C).
Java source (3)
Source code to implement the sieve of Eratosthenes in Java or Java script.
Resources in programs : sieves : Eratosthenes
  • An XSLT version - A stylesheet(!!) that computes prime numbers according to the known algorithm "Sieve of Eratosthenes." (This is done for humor, not efficiency!)
    (Added: 3-Aug-2000 Hits: 4960 Rating: 10.00 Votes: 2) Rate It
  • Colored JavaScript version - A JavaScript that shows the sieve of Eratosthenes. Marks the primes in green and the composites in red. The larger the smallest composite, the brighter the red. The brightness of the primes also increases when the primes get bigger. By default the first 43 numbers are checked, to check higher or lower numbers, for example 1000, add ?1000 to the URL.
    (Added: 27-Aug-2004 Hits: 4721 Rating: 6.50 Votes: 2) Rate It
  • eratosthenes sieve - Interactive animation of Eratosthenes' sieve in JavaScript
    (Added: 7-Feb-2001 Hits: 8281 Rating: 8.84 Votes: 39) Rate It
  • Very fast calculation of small primes. - Das Programm ist in effizientem C/C++ geschrieben. Der Algorithmus unterscheidet sich von einem konventionellem Test im wesentlichen in zwei Punkten.
    (Added: 21-Sep-2004 Hits: 5495 Rating: 6.00 Votes: 7) Rate It
Related Topics
Last Updated: 30-Jul-2014
The Prime Pages © 2000-2008
Chris K. Caldwell
Search:
more options ...
CGI Powered by Gossamer Threads