Hostname: page-component-76fb5796d-vfjqv Total loading time: 0 Render date: 2024-04-27T02:52:19.223Z Has data issue: false hasContentIssue false

Two compact incremental prime sieves

Published online by Cambridge University Press:  01 November 2015

Jonathan P. Sorenson*
Affiliation:
Computer Science and Software Engineering, Butler University, Indianapolis, IN 46208, USA email sorenson@butler.edu

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

A prime sieve is an algorithm that finds the primes up to a bound $n$. We say that a prime sieve is incremental, if it can quickly determine if $n+1$ is prime after having found all primes up to $n$. We say a sieve is compact if it uses roughly $\sqrt{n}$ space or less. In this paper, we present two new results.

We describe the rolling sieve, a practical, incremental prime sieve that takes $O(n\log \log n)$ time and $O(\sqrt{n}\log n)$ bits of space.

We also show how to modify the sieve of Atkin and Bernstein from 2004 to obtain a sieve that is simultaneously sublinear, compact, and incremental.

The second result solves an open problem given by Paul Pritchard in 1994.

Type
Research Article
Copyright
© The Author 2015 

References

Atkin, A. O. L. and Bernstein, D. J., ‘Prime sieves using binary quadratic forms’, Math. Comp. 73 (2004) 10231030.CrossRefGoogle Scholar
Bach, E. and Shallit, J. O., Algorithmic number theory, vol. 1 (MIT Press, 1996).Google Scholar
Bach, E. and Sorenson, J. P., ‘Approximately counting semismooth integers’, Proceedings of the 38th International Symposium on Symbolic and Algebraic Computation, ISSAC ’13 (ACM, New York, NY, 2013) 2330.Google Scholar
Bays, C. and Hudson, R., ‘The segmented sieve of Eratosthenes and primes in arithmetic progressions to 1012 ’, BIT 17 (1977) 121127.CrossRefGoogle Scholar
Bengelloun, S., ‘An incremental primal sieve’, Acta Inform. 23 (1986) no. 2, 119125.CrossRefGoogle Scholar
Brent, R. P., ‘The first occurrence of large gaps between successive primes’, Math. Comp. 27 (1973) no. 124, 959963.CrossRefGoogle Scholar
Cherkassky, B. V., Goldberg, A. V. and Silverstein, C., ‘Buckets, heaps, lists, and monotone priority queues’, SIAM J. Comput. 28 (1999) no. 4, 13261346, doi:10.1137/S0097539796313490.CrossRefGoogle Scholar
Crandall, R. and Pomerance, C., Prime numbers, a computational perspective (Springer, New York, 2001).CrossRefGoogle Scholar
Dunten, B., Jones, J. and Sorenson, J. P., ‘A space-efficient fast prime number sieve’, Inform. Process. Lett. 59 (1996) 7984.CrossRefGoogle Scholar
Erdös, P. and Kac, M., ‘The Gaussian law of errors in the theory of additive number theoretic functions’, Amer. J. Math. 62 (1940) no. 1, 738742.CrossRefGoogle Scholar
Galway, W. F., ‘Robert Bennion’s ‘hopping sieve’’, Proceedings of the Third International Symposium on Algorithmic Number Theory, ANTS-III (Springer, Berlin, Heidelberg, 1998) 169178.Google Scholar
Galway, W. F., ‘Dissecting a sieve to cut its need for space’, Algorithmic number theory, Leiden, 2000 , Lecture Notes in Computer Science 1838 (Springer, Berlin, 2000) 297312.Google Scholar
Galway, W. F., ‘Analytic computation of the prime-counting function’. PhD Thesis, University of Illinois at Urbana-Champaign, 2004, available at http://www.math.uiuc.edu/∼galway/PhD_Thesis/.Google Scholar
Hardy, G. H. and Wright, E. M., An introduction to the theory of numbers , 5th edn (Oxford University Press, 1979).Google Scholar
Knuth, D. E., The art of computer programming: seminumerical algorithms, vol. 2 , 3rd edn (Addison-Wesley, Reading, MA, 1998).Google Scholar
Pritchard, P., ‘A sublinear additive sieve for finding prime numbers’, Commun. ACM 24 (1981) no. 1, 1823; 772.CrossRefGoogle Scholar
Pritchard, P., ‘Fast compact prime number sieves (among others)’, J. Algorithms 4 (1983) 332344.CrossRefGoogle Scholar
Pritchard, P., ‘Linear prime-number sieves: A family tree’, Sci. Comput. Program. 9 (1987) 1735.CrossRefGoogle Scholar
Pritchard, P., ‘Improved incremental prime number sieves’, First International Algorithmic Number Theory Symposium (ANTS-1) , Lecture Notes in Computer Sciences 877 (eds Adleman, L. M. and Huang, M.-D.; Springer, Berlin, Heidelberg, 1994) 280288.CrossRefGoogle Scholar
Singleton, R. C., ‘Algorithm 357: An efficient prime number generator [a1]’, Commun. ACM 12 (1969) no. 10, 563564.Google Scholar
Sorenson, J. P., ‘Trading time for space in prime number sieves’, Proceedings of the Third International Algorithmic Number Theory Symposium (ANTS III) , Lecture Notes in Computer Sciences 1423 (ed. Buhler, J.; Springer, Berlin, Heidelberg, 1998) 179195.Google Scholar
Sorenson, J. P., ‘The pseudosquares prime sieve’, Proceedings of the 7th International Symposium on Algorithmic Number Theory (ANTS-VII) , Lecture Notes in Computer Sciences 4076 (eds Hess, F., Pauli, S. and Pohst, M.; Springer, Berlin, Germany, 2006) 193207; ISBN 3-540-36075-1.CrossRefGoogle Scholar
Sorenson, J. P. and Parberry, I., ‘Two fast parallel prime number sieves’, Inf. Comput. 144 (1994) no. 1, 115130.CrossRefGoogle Scholar
Walisch, K., ‘primesieve: Fast c/c++ prime number generator’, http://primesieve.org, 2015.Google Scholar