Fast deterministic tests
A deterministic primality test is the cyclotomy test; its runtime can be proven to be O(nclog(log(n))), where n is the number of digits of N and c is a constant independent of n. This is slower than polynomial, but not much. In fact, for numbers N with up to 1000 digits or so, this is the fastest known method.
The elliptic curve primality test can be proven to run in O(n6), but only if some still unproven (but widely assumed to be true) statements of analytic number theory are used. In practice, this test is slower than the cyclotomy test for numbers with up to 10,000 digits or so.
The implementation of these two methods is rather difficult, and their error probabilities in practice may therefore be even higher than those of the probabilistic methods mentioned above.
If the generalized Riemann hypothesis is assumed, the Miller-Rabin test can be turned into a deterministic version with runtime O(n4). In practice, this algorithm is slower than the other two for sizes of numbers that can be dealt with at all.
In 2002, Manindra Agarwal, Nitin Saxena and Neeraj Kayal described a new deterministic primality test which runs in Õ(n12), and this bound can be rigorously proven. In addition, given a certain unproven, but widely believed to be true, conjecture, it runs in Õ(n6). As such, this provided the first deterministic primality test with provably polynomial run-time. In practice, this algorithm is slower than the other methods.
Number theoretical methods
Certain number theoretical methods exist, such as the Lucas-Lehmer primality test for testing whether a number is prime.
The Lucas-Lehmer test relies on the fact that the if the multiplicative order of some number a modulo n is n-1 for a prime n\ when a is primitive. If we can show a is primitive for n, we can show n is prime.
External links