A language belongs to RP when a polynomial-time randomized algorithm rejects every and accepts every with probability at least .
Amplify the algorithm on length- inputs with independent repetitions, accepting if any repetition accepts. Its error on each positive input is at most , while it still never accepts a negative input. Choose all random bits for all repetitions in advance. By the union bound, the probability that this one fixed choice fails on at least one of the at most positive strings is at most
Thus some random string works simultaneously for every input of length . Hardwire that string into the polynomial-time computation and compile it into a Boolean circuit. The resulting polynomial-size circuit family decides , proving
First suppose . Run the RP algorithm for and the RP algorithm for its complement with fresh random bits. If the first accepts, output one; if the second accepts, output zero; otherwise repeat. Neither output can be wrong, and on every input the appropriate algorithm accepts in each round with probability at least . The number of rounds is dominated by a geometric distribution of mean two, so this is an always-correct algorithm with polynomial expected running time.
Conversely, let be always correct when it halts and have expected running time at most . Run it for steps. Markov inequality gives
Accept exactly when halts and outputs one; this is an RP algorithm for . Accepting exactly when it halts and outputs zero is an RP algorithm for the complement. Therefore
is equivalent to zero-error expected polynomial time.
We give the Agrawal–Biswas primality test, which has one-sided error. Small inputs and perfect powers can first be recognized deterministically. For every remaining integer , put and choose a uniformly random monic polynomial
Using repeated squaring in the quotient ring , test the identity
This takes time polynomial in because every intermediate polynomial has degree below .
If is prime, the intermediate binomial coefficients are divisible by , so the identity always holds. Now suppose that is composite and is not a prime power. Choose a prime divisor and write with and . Over ,
because an intermediate coefficient equal to is nonzero modulo . Hence
is a nonzero polynomial of degree below over .
Reduction of random modulo is uniform among the monic degree- polynomials. The polynomial has at most distinct monic irreducible factors of degree . On the other hand, the number of monic irreducibles of degree obeys the standard lower bound
Whenever is one of these irreducibles but does not divide , the tested congruence fails. Thus one trial detects compositeness with probability at least
after the finitely many small are handled directly. Repeating times makes the probability of missing a composite less than , while a prime is never rejected. Therefore compositeness is in RP, and primality testing is in

Articles by others on the same topic (0)

There are currently no matching articles.