Primality Testing
Mathematicians have tried in vain to this day to discover some order in the sequence of prime numbers, and we have reason to believe that it is a mystery into which the human mind will never penetrate. L. EULER.
Abstract: Our objective is to find a polynomial-time foolproof algorithm to determine whether a given integer is prime. Everyone knows trial division, in which we try to divide n by every integer m in the range
.The number of steps in this algorithm will be at least the number of integers m we consider, which is something like
in the worst case (when n is prime). Note that
is roughly
where d is the number of digits of n when written in binary (and d is roughly log{n} where, here and throughout, we will take logarithms in base 2). We first present few basic algorithms for primality testing and then proceed with AKS algorithm[2].
Introduction:
There are few better known or more easily understood problems in pure mathematics than the question of rapidly determining whether a given integer is prime. The problem of distinguishing prime numbers from composite numbers, and of resolving the latter into their prime factors is known to be one of the most important and useful in arithmetic. It has engaged the industry and wisdom of ancient and modern geometers to such an extent that it would be superfluous to discuss the problem at length. Nevertheless we must confess that all methods that have been proposed thus far are either restricted to very special cases or are so laborious and difficult that even for numbers that do not exceed the limits of tables constructed by estimable men, they try the patience of even the practiced calculator. And these methods do not apply at all to larger numbers.
Primes come up in many different places in the mathematical literature, and some of these suggest ways to distinguish primes from composites. Those of us who are interested in primality testing always look at anything new with one eye open to this application, and yet finding a fast primality testing algorithm has remained remarkably elusive. See [4] and [5] for probabilistic and randomized primality testing methods. The advent of the AKS algorithm makes us wonder whether we have missed some such algorithm, something that one could perform in a few minutes, by hand, on any enormous number.
The ultimate goal of this line of research has been, of course, to obtain an unconditional deterministic polynomial-time algorithm for primality testing. This is achieved by the AKS algorithm. Next we give the mathematical background to understand the algorithms for Primality testing.