PRIMES is in P #
The primes, given in binary, are decidable in deterministic polynomial time
Agrawal, Kayal, Saxena. The decider is the AKS algorithm on the word RAM
(Cslib.Algorithms.WordRAM.AKS.decidesInTime), with n placed in one word, simulated by a
multi-tape Turing machine through Cslib.WordRAM.Program.DecidesInTime.mem_P_of_width. The
simulating machine chooses the word size 8 (|n| + 1) from the length |n| of the binary
encoding, and the word-RAM program runs within a polynomial in |n| instructions
(Cslib.Algorithms.WordRAM.AKS.polynomiallyBounded_time).
The algorithm uses the integer thresholds ⌈log₂ n⌉ in place of log₂ n
(Cslib.AKS.PassesUpTo); its correctness is Theorem 4.1 of the paper
(Cslib.AKS.prime_iff_passesUpTo_numTestsNat).
Main results #
Cslib.Complexity.primes_mem_P: the primes are inP, for the binary encodingencNat.
References #
PRIMES is in P Agrawal, Kayal, Saxena: primality of naturals given by their
binary digits is decidable in polynomial time.