 
Summary: PRIMES is in P
Manindra Agrawal, Neeraj Kayal and Nitin Saxena
Department of Computer Science & Engineering
Indian Institute of Technology Kanpur
Kanpur208016, INDIA
August 6, 2002
Abstract
We present a deterministic polynomialtime algorithm that determines whether an input number
n is prime or composite.
"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... Further, the dignity of the science itself seems to require that every
possible means be explored for the solution of a problem so elegant and so celebrated."
 Karl Friedrich Gauss, Disquisitiones Arithmeticae, 1801 (translation from [Knu98])
1 Introduction
Since ancient times, mathematicians have been fascinated by problems concerning prime numbers. One
of the fundamental problems concerning prime numbers is to determine if a given number is prime. In
modern times, primality testing has also become important from a practical perspective because of its
applications in cryptography.
