7 research outputs found

    Two Compact Incremental Prime Sieves

    Get PDF
    A prime sieve is an algorithm that finds the primes up to a bound nn. We say that a prime sieve is incremental, if it can quickly determine if n+1n+1 is prime after having found all primes up to nn. We say a sieve is compact if it uses roughly n\sqrt{n} space or less. In this paper we present two new results: (1) We describe the rolling sieve, a practical, incremental prime sieve that takes O(nloglogn)O(n\log\log n) time and O(nlogn)O(\sqrt{n}\log n) bits of space, and (2) We show how to modify the sieve of Atkin and Bernstein (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

    The I/O Complexity of Computing Prime Tables

    Get PDF
    International audienceWe revisit classical sieves for computing primes and analyze their performance in the external-memory model. Most prior sieves are analyzed in the RAM model, where the focus is on minimizing both the total number of operations and the size of the working set. The hope is that if the working set fits in RAM, then the sieve will have good I/O performance, though such an outcome is by no means guaranteed by a small working-set size. We analyze our algorithms directly in terms of I/Os and operations. In the external-memory model, permutation can be the most expensive aspect of sieving, in contrast to the RAM model, where permutations are trivial. We show how to implement classical sieves so that they have both good I/O performance and good RAM performance, even when the problem size N becomes huge—even superpolynomially larger than RAM. Towards this goal, we give two I/O-efficient priority queues that are optimized for the operations incurred by these sieves

    Two compact incremental prime sieves

    Get PDF

    The pseudosquares prime sieve

    Get PDF
    Abstract. We present the pseudosquares prime sieve

    A Space-Efficient Fast Prime Number Sieve

    No full text
    We present a new algorithm that finds all primes up to n using at most O(n= log log n) arithmetic operations and O(n=(log n log log n)) space. This algorithm is an improvement of a linear prime number sieve due to Pritchard. Our new algorithm matches the running time of the best previous prime number sieve, but uses less space by a factor of \Theta(log n). In addition, we present the results of our implementations of most known prime number sieves. Key Words: prime number sieve, sieve of Eratosthenes, number theoretic algorithms, analysis of algorithms, design of algorithms 1 Introduction A prime number sieve is an algorithm that constructs a list of primes up to a given bound n. Eratosthenes is believed to be the inventor of the first prime number sieve over 2000 years ago. His sieve requires \Theta(n log log n) arithmetic operations and \Theta(n) space (see [4]). Currently, the fastest sieve is Pritchard's dynamic wheel sieve [8, 9]; it requires only \Theta(n= log log n) operat..
    corecore