Abstract
We present the pseudosquares prime sieve, which finds all primes up to n. Define p to be the smallest prime such that the pseudosquare L p > n/(π(p)(logn)2); here π(x) is the prime counting function. Our algorithm requires only O(π(p)n) arithmetic operations and O(π(p)logn) space. It uses the pseudosquares primality test of Lukes, Patterson, and Williams.
Under the assumption of the Extended Riemann Hypothesis, we have p≤2(logn)2, but it is conjectured that \(p\sim \frac{1}{\log 2}\log n \log\log n\). Thus, the conjectured complexity of our prime sieve is O(nlogn) arithmetic operations in O((logn)2) space. The primes generated by our algorithm are proven prime unconditionally. The best current unconditional bound known is \(p \le n^{1/(4\sqrt{e}-\epsilon)}\), implying a running time of roughly n 1.132 using roughly n 0.132 space.
Existing prime sieves are generally faster but take much more space, greatly limiting their range (O(n/loglogn) operations with n 1/3 + ε space, or O(n) operations with n 1/4 conjectured space). Our algorithm found all 13284 primes in the interval [1033,1033+106] in about 4 minutes on a 1.3GHz Pentium IV.
We also present an algorithm to find all pseudosquares L p up to n in sublinear time using very little space. Our innovation here is a new, space-efficient implementation of the wheel datastructure.
This is a preview of subscription content, access via your institution.
Buying options
Preview
Unable to display preview. Download preview PDF.
References
Agrawal, M., Kayal, N., Saxena, N.: PRIMES is in P (2003), http://www.cse.iitk.ac.in/news/primality_v3.pdf
Atkin, A.O.L., Bernstein, D.J.: Prime sieves using binary quadratic forms. Mathematics of Computation 73, 1023–1030 (2004)
Bach, E.: Analytic Methods in the Analysis and Design of Number-Theoretic Algorithms. MIT Press, Cambridge (1985)
Bach, E., Huelsbergen, L.: Statistical evidence for small generating sets. Math. Comp. 61(203), 69–82 (1993)
Bach, E., Shallit, J.O.: Algorithmic Number Theory, vol. 1. MIT Press, Cambridge (1996)
Bach, E., Sorenson, J.P.: Sieve algorithms for perfect power testing. Algorithmica 9(4), 313–328 (1993)
Bernstein, D.J.: Detecting perfect powers in essentially linear time. Math. Comp. 67(223), 1253–1283 (1998)
Bernstein, D.J.: Proving primality in essentially quartic time. Mathematics of Computation (to appear, 2006), http://cr.yp.to/papers.html#quartic
Bernstein, D.J., Lenstra Jr., H.W., Pila, J.: Detecting perfect powers by factoring into coprimes. Mathematics of Computation (to appear, 2006)
Dunten, B., Jones, J., Sorenson, J.P.: A space-efficient fast prime number sieve. Information Processing Letters 59, 79–84 (1996)
Galway, W.F.: Dissecting a sieve to cut its need for space. In: Bosma, W. (ed.) ANTS 2000. LNCS, vol. 1838, pp. 297–312. Springer, Heidelberg (2000)
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/
Granlund, T.: The Gnu multiple precision arithmetic library, edition 4.1.3 (2004), http://www.swox.se/gmp/manual
Hardy, G.H., Wright, E.M.: An Introduction to the Theory of Numbers, 5th edn. Oxford University Press, Oxford (1979)
Lukes, R.F., Patterson, C.D., Williams, H.C.: Some results on pseudosquares. Math. Comp. 65(213), 361–372, S25–S27 (1996)
Miller, G.: Riemann’s hypothesis and tests for primality. Journal of Computer and System Sciences 13, 300–317 (1976)
Pomerance, C., Selfridge, J.L., Wagstaff Jr., S.S.: The pseudoprimes to 25 ·109. Math. Comp. 35(151), 1003–1026 (1980)
Pritchard, P.: A sublinear additive sieve for finding prime numbers. Communications of the ACM 24(1), 18–23,772 (1981)
Pritchard, P.: Fast compact prime number sieves (among others). Journal of Algorithms 4, 332–344 (1983)
Rabin, M.O.: Probabilistic algorithm for testing primality. Journal of Number Theory 12, 128–138 (1980)
Schinzel, A.: On pseudosquares. New Trends in Prob. and Stat. 4, 213–220 (1997)
Solovay, R., Strassen, V.: A fast Monte Carlo test for primality. SIAM Journal on Computing 6, 84–85 (1977); Erratum in vol. 7, p. 118 (1978)
Sorenson, J.P.: Trading time for space in prime number sieves. In: Buhler, J.P. (ed.) ANTS 1998. LNCS, vol. 1423, pp. 179–195. Springer, Heidelberg (1998)
Sorenson, J.P., Parberry, I.: Two fast parallel prime number sieves. Information and Computation 144(1), 115–130 (1994)
Stroustrup, B.: The C++ Programming Language, 2nd edn. Addison-Wesley, Reading (1991)
Williams, H.C.: Édouard Lucas and primality testing. Canadian Mathematical Society Series of Monographs and Advanced Texts, vol. 22. John Wiley & Sons Inc., New York (1998); A Wiley-Interscience Publication
Wooding, K.: Development of a high-speed hybrid sieve architecture. Master’s thesis, The University of Calgary, Calgary, Alberta (November 2003)
Wooding, K., Williams, H.C.: Doubly-focused enumeration of pseudosquares and pseudocubes. In: Hess, F., Pauli, S., Pohst, M. (eds.) ANTS 2006. LNCS, vol. 4076, pp. 208–221. Springer, Heidelberg (2006)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Sorenson, J.P. (2006). The Pseudosquares Prime Sieve. In: Hess, F., Pauli, S., Pohst, M. (eds) Algorithmic Number Theory. ANTS 2006. Lecture Notes in Computer Science, vol 4076. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11792086_15
Download citation
DOI: https://doi.org/10.1007/11792086_15
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-36075-9
Online ISBN: 978-3-540-36076-6
eBook Packages: Computer ScienceComputer Science (R0)
