Summary: PRIMES is in P
Manindra Agrawal Neeraj Kayal
Department of Computer Science & Engineering
Indian Institute of Technology Kanpur
We present an unconditional deterministic polynomial-time algorithm that determines whether
an input number is prime or composite.
Prime numbers are of fundamental importance in mathematics in general, and number theory in par-
ticular. So it is of great interest to study different properties of prime numbers. Of special interest are
those properties that allow one to efficiently determine if a number is prime. Such efficient tests are also
useful in practice: a number of cryptographic protocols need large prime numbers.
Let PRIMES denote the set of all prime numbers. The definition of prime numbers already gives a
way of determining if a number n is in PRIMES: try dividing n by every number m
n--if any m
divides n then it is composite, otherwise it is prime. This test was known since the time of the ancient