Primality testing is the decision problem of determining whether an input integer is a prime number.
A probable prime is an integer that passes a specified necessary test for primality without thereby receiving a proof of primality. The qualification must identify the test and bases. For example, an odd passing a Fermat test to base satisfies , but a composite can satisfy that congruence.
The Miller-Rabin primality test imposes a stronger condition on a chain of modular squares. Yet passes even that test to base 2: writing , one has . A pass therefore means “not disproved by this test”, whereas a failing witness proves compositeness. With independent uniformly sampled bases, the standard worst-case error bound decreases exponentially with the number of rounds; it is a conditional test-error bound, not automatically the posterior probability that the particular input is prime.[ref]
An integer for which replacing any one decimal numerical digit by a different digit never produces a prime number. The convention must specify whether changes creating a leading zero are permitted. An exact test enumerates the allowed substitutions and applies primality testing to each result.
For an odd integer , write with odd. Choose a base uniformly from . It passes the Miller–Rabin test when
A nontrivial greatest common divisor of or failure certifies compositeness. Exponentiation by squaring computes ; at most further squarings test the other possibilities.
Every prime number passes: arithmetic modulo a prime number is a field, whose only square roots of one are and . The squaring chain ends at one by the Fermat little theorem; its first one is either the initial value or follows minus one.
For an odd composite number, at most one quarter of bases in the stated range pass. Thus independently sampled bases give false probable-prime probability at most , for each fixed composite input. A passing composite is a strong pseudoprime to that base.[ref]
A strong liar for an odd composite integer is a base for which the Miller-Rabin primality test reports a pass. Write with odd. A base is a strong liar when
The base “lies” because these conditions hold for every allowed nonzero base when is prime, but can also hold for a composite.
For , base 2 is a strong liar because and divides . For every odd composite, strong liars occupy at most a quarter of the standard base sampling space; independently sampling bases bounds all-pass error by . A fixed handpicked list needs a separate guarantee for the intended input range.[ref]
A deterministic Miller-Rabin primality test chooses bases justified to distinguish every composite in a specified input range, instead of sampling bases for a probabilistic guarantee. For each base, write with odd , test , and square successively according to the Miller-Rabin primality test. A failing base certifies compositeness; passing a fixed list certifies primality only under the proven range theorem for that list. For machine integers such as , established finite-range base sets permit deterministic implementations. The exact bases, bound, treatment of small primes and modular-arithmetic overflow are part of the algorithm's contract.
The Fermat test looks for a coprime base with . Such a witness proves compositeness by the Fermat little theorem, but Carmichael numbers pass for every coprime base.
A base coprime to the tested odd composite for which a specified probable-prime criterion passes. The sets of passing bases depend on the criterion and need not be subgroups.
The Agrawal–Biswas primality test tests a formal polynomial identity in :
For , the identity holds exactly when is a prime number. Testing a formal polynomial is stronger than evaluating it at residues.
The randomized algorithm first handles prime numbers at most thirteen, divisibility by them, and perfect powers. For remaining , choose a monic polynomial of polynomial degree , with independent uniform lower coefficients modulo . Compute the remainder of modulo using exponentiation by squaring. A nonzero remainder proves compositeness. The monic polynomial permits division even when the coefficient ring has zero divisors.
Every prime number passes. After preprocessing, a composite number is rejected with probability at least per trial, so independent trials give error at most . Keeping remainders below polynomial degree makes the computation polynomial time in the bit length of .[ref]

Articles by others on the same topic (0)

There are currently no matching articles.