article
Free Access

A practical sieve algorithm finding prime numbers

Published:01 March 1989Publication History
Skip Abstract Section

Abstract

Based on the sieve of Eratosthenes, a faster and more compact algorithm is presented for finding all primes between 2 and N.

References

  1. 1 Dijkstra, E.W. Gttarded commands, nondeterminacy and formal derivation of programs. Commun. ACM 18, 8 (Aug. 1975), 453-457. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2 Gries, D., and Misra, J. A linear sieve algorithm for finding prime numbers. Commz n. ACM 21, 12 (Dec. 1978), 999-1003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3 Knuth, D. The Alt of Computer Programming. Vol. 2, 2d ed. 1981, p. 394.Google ScholarGoogle Scholar
  4. 4 Mairson, H.G. Same new upper bounds on the generation of prime numbers. Commltn. ACM 20, 9 (Sept. 1977), 664-669. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5 Pritchard, P. A sllblinear additive sieve for finding prime numbers. Commun. ACM 2,!, I (Jan. 1981), 18-23. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A practical sieve algorithm finding prime numbers

        Reviews

        Thomas Zeugmann

        The author presents a sieve algorithm that determines all primes between 2 and N in time O( N log log N) with storage requirement O( N). Consequently, neglecting constant factors, this algorithm has the same complexity as Eratosthenes' sieve. The new algorithm, however, decreases the constants. This linear speedup is achieved by dealing with the elements 5, 7, 11, 3 i + 2, 3( i + 1) + 1, . . . , - N only, where i is odd. Moreover, this new algorithm is even more compact than Eratosthenes' sieve. Nevertheless, the paper would have been more readable if the author had used only one “programming language” to formulate the algorithms, or if he had been denotationally more precise. Finally, since he states that Pritchard's O( N/log log N) additive sieve algorithm has more theoretical than practical significance, it would have been better to compare the new algorithm with Pritchard's sieve instead of with Eratosthenes's.

        Access critical reviews of Computing literature here

        Become a reviewer for Computing Reviews.

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image Communications of the ACM
          Communications of the ACM  Volume 32, Issue 3
          March 1989
          98 pages
          ISSN:0001-0782
          EISSN:1557-7317
          DOI:10.1145/62065
          Issue’s Table of Contents

          Copyright © 1989 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 March 1989

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!