TOPICS
Search

Sieve of Atkin


The sieve of Atkin is a sieve for generating prime numbers up to a given bound using representations of integers by binary quadratic forms. Unlike the sieve of Eratosthenes, which removes multiples of primes, it tests the parity of representation counts and removes multiples of squares of primes (Atkin and Bernstein 2004).

For a squarefree integer n>3 relatively prime to 6, the appropriate representation test depends on its residue class modulo 12. If n=1 (mod 4), count solutions of 4x^2+y^2=n with positive integers x and y. If n=7 (mod 12), count solutions of 3x^2+y^2=n with positive integers x and y. If n=11 (mod 12), count solutions of 3x^2-y^2=n with integers x>y>0. In each case, n is prime iff the count is odd (Atkin and Bernstein 2004).

To form a sieve, candidate flags are toggled for each representation and candidates divisible by a square of a prime are then removed. The primes 2 and 3 are included separately. Atkin and Bernstein (2004) gave an optimized implementation using O(N/lnlnN) operations on O(lnN)-bit integers and N^(1/2+o(1)) bits of working memory to generate the primes up to N. These bounds apply to their optimized algorithm, not to an arbitrary implementation of the representation tests.


See also

Binary Quadratic Form, Prime Number, Sieve, Sieve of Eratosthenes, Squarefree

Explore with Wolfram|Alpha

References

Atkin, A. O. L. and Bernstein, D. J. "Prime Sieves Using Binary Quadratic Forms." Math. Comput. 73, 1023-1030, 2004. https://doi.org/10.1090/S0025-5718-03-01501-1.

Cite this as:

Weisstein, Eric W. "Sieve of Atkin." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/SieveofAtkin.html

Subject classifications