Generated by GPT-5-mini| Sieve of Eratosthenes | |
|---|---|
![]() SKopp at German Wikipedia · CC BY-SA 3.0 · source | |
| Name | Sieve of Eratosthenes |
| Type | Algorithm |
| Inventor | Eratosthenes |
| Year | Classical antiquity |
| Problem | Prime number generation |
| Complexity | O(n log log n) |
Sieve of Eratosthenes is a classical algorithm for finding all prime numbers up to a given limit, originating in Alexandria and associated with Eratosthenes of Cyrene, who worked in the milieu of Ptolemaic Egypt during the era of Hellenistic Greece. The method iteratively marks multiples of successive primes, producing a list of primes used throughout the history of mathematics and adopted in many computational contexts in the modern era of Alan Turing, John von Neumann, and Ada Lovelace inspired computing. Its conceptual simplicity has influenced optimizations by researchers linked to institutions such as Massachusetts Institute of Technology, Stanford University, and University of Cambridge.
Eratosthenes, a scholar at the Library of Alexandria and head of the Mouseion, composed works while contemporaneous with figures like Ptolemy III Euergetes; the earliest descriptions of the sieve are preserved in later commentaries by scholars in Byzantium and medieval Islamic Golden Age centers such as Baghdad and Cordoba. Subsequent transmission involved commentators connected to Al-Khwarizmi, Omar Khayyam, and later European mathematicians in Renaissance circles around Galileo Galilei and Pierre de Fermat, with formal analysis emerging in the periods of Carl Friedrich Gauss and Sophie Germain. In the 20th century the sieve was implemented on early computers at Harvard University and Princeton University and discussed in works influenced by Emmy Noether and David Hilbert.
The basic procedure initializes an array indexed by integers up to n and marks composite entries by stepping through multiples; the approach echoes enumerative techniques used by scholars in Alexandria and appears in expositions associated with Euclid and Diophantus. Start by listing integers from 2 to n, then repeatedly select the next unmarked integer p and mark its multiples 2p, 3p, ...; stop when p exceeds sqrt(n), a bound tied to results proved by Euler and refined in proofs by Legendre and Chebyshev. Implementations in code repositories inspired by work at Bell Labs and IBM exploit array operations and bitset representations discussed in expositions by Donald Knuth and practitioners at Microsoft Research.
Correctness follows from the fundamental theorem of arithmetic, a principle elaborated by Euclid and articulated in later form by Ernst Kummer and Richard Dedekind; every composite number has a prime factor ≤ sqrt(n), ensuring that marking multiples eliminates all composites. Time complexity is commonly given as O(n log log n), an analytic bound derived using estimates linked to the Prime Number Theorem proved by Jacques Hadamard and Charles-Jean de la Vallée Poussin; space complexity depends on representation choices and was optimized in studies at University of California, Berkeley and ETH Zurich. Empirical performance comparisons in numerical analysis literature from Princeton University and University of Oxford examine cache behavior and parallelism relevant to architectures designed by Intel and ARM Holdings.
Variants include segmented sieves popularized in implementations associated with GNU projects and academic groups at University of Illinois Urbana-Champaign, wheel factorization techniques tied to residue class ideas used by Srinivasa Ramanujan admirers, and bit-packed sieves employed in systems developed by Google and Facebook. Parallel and distributed adaptations have been pursued in clusters at Argonne National Laboratory and Lawrence Livermore National Laboratory, while cache-friendly block sieves draw on studies from Max Planck Society and Los Alamos National Laboratory. Mathematical refinements connect to work by Atkin and Goldwasser in algorithmic number theory, and to sieve-theoretic frameworks explored by Heath-Brown and Bombieri in analytic number theory.
Practical applications include cryptographic key generation in standards promulgated by National Institute of Standards and Technology and used in protocols designed by teams at RSA Security and OpenSSL. Implementations appear in programming language libraries maintained by communities around Python (programming language), C++, Java (programming language), and runtime systems at Oracle Corporation; high-performance variants run on hardware by NVIDIA and AMD for research in computational number theory conducted at Institute for Advanced Study and Carnegie Mellon University. Educational expositions appear in curricula at University of Cambridge and Massachusetts Institute of Technology, while benchmarking and large-scale prime searches are coordinated by projects linked to Great Internet Mersenne Prime Search and groups collaborating with European Organization for Nuclear Research.
Category:Algorithms