HOME

TheInfoList



OR:

The Solovay–Strassen
primality test A primality test is an algorithm for determining whether an input number is prime. Among other fields of mathematics, it is used for cryptography. Unlike integer factorization, primality tests do not generally give prime factors, only stating wh ...
, developed by Robert M. Solovay and Volker Strassen in 1977, is a
probabilistic Probability is the branch of mathematics concerning numerical descriptions of how likely an event is to occur, or how likely it is that a proposition is true. The probability of an event is a number between 0 and 1, where, roughly speaking, ...
test to determine if a number is composite or probably prime. The idea behind the test was discovered by M. M. Artjuhov in 1967 (see Theorem E in the paper). This test has been largely superseded by the
Baillie–PSW primality test The Baillie–PSW primality test is a probabilistic primality testing algorithm that determines whether a number is composite or is a probable prime. It is named after Robert Baillie, Carl Pomerance, John Selfridge, and Samuel Wagstaff. The Baill ...
and the
Miller–Rabin primality test The Miller–Rabin primality test or Rabin–Miller primality test is a probabilistic primality test: an algorithm which determines whether a given number is likely to be prime, similar to the Fermat primality test and the Solovay–Strassen pri ...
, but has great historical importance in showing the practical feasibility of the
RSA RSA may refer to: Organizations Academia and education * Rabbinical Seminary of America, a yeshiva in New York City *Regional Science Association International (formerly the Regional Science Association), a US-based learned society *Renaissance S ...
cryptosystem In cryptography, a cryptosystem is a suite of cryptographic algorithms needed to implement a particular security service, such as confidentiality (encryption). Typically, a cryptosystem consists of three algorithms: one for key generation, one f ...
. The Solovay–Strassen test is essentially an Euler–Jacobi pseudoprime test.


Concepts

Euler Leonhard Euler ( , ; 15 April 170718 September 1783) was a Swiss mathematician, physicist, astronomer, geographer, logician and engineer who founded the studies of graph theory and topology and made pioneering and influential discoveries in ma ...
proved that for any odd
prime number A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only way ...
''p'' and any integer ''a'', :a^ \equiv \left(\frac\right) \pmod p where \left(\tfrac\right) is the
Legendre symbol In number theory, the Legendre symbol is a multiplicative function with values 1, −1, 0 that is a quadratic character modulo an odd prime number ''p'': its value at a (nonzero) quadratic residue mod ''p'' is 1 and at a non-quadratic residue ...
. The
Jacobi symbol Jacobi symbol for various ''k'' (along top) and ''n'' (along left side). Only are shown, since due to rule (2) below any other ''k'' can be reduced modulo ''n''. Quadratic residues are highlighted in yellow — note that no entry with a J ...
is a generalisation of the Legendre symbol to \left(\tfrac\right), where ''n'' can be any odd integer. The Jacobi symbol can be computed in time O((log ''n'')²) using Jacobi's generalization of the
law of quadratic reciprocity In number theory, the law of quadratic reciprocity is a theorem about modular arithmetic that gives conditions for the solvability of quadratic equations modulo prime numbers. Due to its subtlety, it has many formulations, but the most standard st ...
. Given an odd number ''n'' we can contemplate whether or not the congruence : a^ \equiv \left(\frac\right) \pmod n holds for various values of the "base" ''a'', given that ''a'' is
relatively prime In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equival ...
to ''n''. If ''n'' is prime then this congruence is true for all ''a''. So if we pick values of ''a'' at random and test the congruence, then as soon as we find an ''a'' which doesn't fit the congruence we know that ''n'' is not prime (but this does not tell us a nontrivial factorization of ''n''). This base ''a'' is called an ''Euler witness'' for ''n''; it is a witness for the compositeness of ''n''. The base ''a'' is called an ''Euler liar'' for ''n'' if the congruence is true while ''n'' is composite. For every composite odd ''n'', at least half of all bases :a \in (\mathbb/n\mathbb)^* are (Euler) witnesses as the set of Euler liars is a proper subgroup of (\mathbb/n\mathbb)^*. For example, for n =65, the set of Euler liars has order 8 and = \, and (\mathbb/n\mathbb)^* has order 48. This contrasts with the
Fermat primality test The Fermat primality test is a probabilistic test to determine whether a number is a probable prime. Concept Fermat's little theorem states that if ''p'' is prime and ''a'' is not divisible by ''p'', then :a^ \equiv 1 \pmod. If one wants to tes ...
, for which the proportion of witnesses may be much smaller. Therefore, there are no (odd) composite ''n'' without many witnesses, unlike the case of
Carmichael number In number theory, a Carmichael number is a composite number n, which in modular arithmetic satisfies the congruence relation: :b^n\equiv b\pmod for all integers b. The relation may also be expressed in the form: :b^\equiv 1\pmod. for all integers ...
s for Fermat's test.


Example

Suppose we wish to determine if ''n'' = 221 is prime. We write (''n''−1)/2=110. We randomly select an ''a'' (greater than 1 and smaller than ''n''): 47. Using an efficient method for raising a number to a power (mod ''n'') such as binary exponentiation, we compute: * ''a''(''n''−1)/2 mod ''n''  =  47110 mod 221  =  −1 mod 221 * (\tfrac) mod ''n''  =  (\tfrac) mod 221  =  −1 mod 221. This gives that, either 221 is prime, or 47 is an Euler liar for 221. We try another random ''a'', this time choosing ''a'' = 2: * ''a''(''n''−1)/2 mod ''n''  =  2110 mod 221  =  30 mod 221 * (\tfrac) mod ''n''  =  (\tfrac) mod 221  =  −1 mod 221. Hence 2 is an Euler witness for the compositeness of 221, and 47 was in fact an Euler liar. Note that this tells us nothing about the prime factors of 221, which are actually 13 and 17.


Algorithm and running time

The algorithm can be written in
pseudocode In computer science, pseudocode is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language, but is intended for human reading rather than machine re ...
as follows: inputs: ''n'', a value to test for primality ''k'', a parameter that determines the accuracy of the test output: ''composite'' if ''n'' is composite, otherwise ''probably prime'' repeat ''k'' times: choose ''a'' randomly in the range ,''n'' − 1 if or then return ''composite'' return ''probably prime'' Using fast algorithms for modular exponentiation, the running time of this algorithm is O(''k''·log3 ''n''), where ''k'' is the number of different values of ''a'' we test.


Accuracy of the test

It is possible for the algorithm to return an incorrect answer. If the input ''n'' is indeed prime, then the output will always correctly be ''probably prime''. However, if the input ''n'' is composite then it is possible for the output to be incorrectly ''probably prime''. The number ''n'' is then called an Euler–Jacobi pseudoprime. When ''n'' is odd and composite, at least half of all ''a'' with gcd(''a'',''n'') = 1 are Euler witnesses. We can prove this as follows: let be the Euler liars and ''a'' an Euler witness. Then, for ''i'' = 1,2,...,''m'': :(a\cdot a_i)^=a^\cdot a_i^= a^\cdot \left(\frac\right) \not\equiv \left(\frac\right)\left(\frac\right)\pmod. Because the following holds: :\left(\frac\right)\left(\frac\right)=\left(\frac\right), now we know that :(a\cdot a_i)^\not\equiv \left(\frac\right)\pmod. This gives that each ''a''''i'' gives a number ''a''·''a''''i'', which is also an Euler witness. So each Euler liar gives an Euler witness and so the number of Euler witnesses is larger or equal to the number of Euler liars. Therefore, when ''n'' is composite, at least half of all ''a'' with gcd(''a'',''n'') = 1 is an Euler witness. Hence, the probability of failure is at most 2−''k'' (compare this with the probability of failure for the
Miller–Rabin primality test The Miller–Rabin primality test or Rabin–Miller primality test is a probabilistic primality test: an algorithm which determines whether a given number is likely to be prime, similar to the Fermat primality test and the Solovay–Strassen pri ...
, which is at most 4−''k''). For purposes of
cryptography Cryptography, or cryptology (from grc, , translit=kryptós "hidden, secret"; and ''graphein'', "to write", or ''-logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of adve ...
the more bases ''a'' we test, i.e. if we pick a sufficiently large value of ''k'', the better the accuracy of test. Hence the chance of the algorithm failing in this way is so small that the (pseudo) prime is used in practice in cryptographic applications, but for applications for which it is important to have a prime, a test like ECPP or the Pocklington primality test should be used which ''proves'' primality.


Average-case behaviour

The bound 1/2 on the error probability of a single round of the Solovay–Strassen test holds for any input ''n'', but those numbers ''n'' for which the bound is (approximately) attained are extremely rare. On the average, the error probability of the algorithm is significantly smaller: it is less than : 2^\exp\left(-(1+o(1))\frac\right) for ''k'' rounds of the test, applied to uniformly random . The same bound also applies to the related problem of what is the conditional probability of ''n'' being composite for a random number which has been declared prime in ''k'' rounds of the test.


Complexity

The Solovay–Strassen algorithm shows that the
decision problem In computability theory and computational complexity theory, a decision problem is a computational problem that can be posed as a yes–no question of the input values. An example of a decision problem is deciding by means of an algorithm whethe ...
COMPOSITE is in the
complexity class In computational complexity theory, a complexity class is a set of computational problems of related resource-based complexity. The two most commonly analyzed resources are time and memory. In general, a complexity class is defined in terms ...
RP.


References


Further reading

* See also *


External links


Solovay-Strassen
Implementation of the Solovay–Strassen primality test in Maple {{DEFAULTSORT:Solovay-Strassen Primality Test Primality tests Modular arithmetic Randomized algorithms