HOME

TheInfoList



OR:

In
computational number theory In mathematics and computer science, computational number theory, also known as algorithmic number theory, is the study of computational methods for investigating and solving problems in number theory and arithmetic geometry, including algorithm ...
, the Lucas test is a primality test for a natural number ''n''; it requires that the
prime factors 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 ways ...
of ''n'' − 1 be already known. It is the basis of the Pratt certificate that gives a concise verification that ''n'' is prime.


Concepts

Let ''n'' be a positive integer. If there exists an integer ''a'', 1 < ''a'' < ''n'', such that :a^\ \equiv\ 1 \pmod n \, and for every prime factor ''q'' of ''n'' − 1 :a^\ \not\equiv\ 1 \pmod n \, then ''n'' is prime. If no such number ''a'' exists, then ''n'' is either 1, 2, or
composite Composite or compositing may refer to: Materials * Composite material, a material that is made from several different substances ** Metal matrix composite, composed of metal and other parts ** Cermet, a composite of ceramic and metallic materials ...
. The reason for the correctness of this claim is as follows: if the first equivalence holds for ''a'', we can deduce that ''a'' and ''n'' are
coprime 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 equivale ...
. If ''a'' also survives the second step, then the order of ''a'' in the
group A group is a number of persons or things that are located, gathered, or classed together. Groups of people * Cultural group, a group whose members share the same cultural identity * Ethnic group, a group whose members share the same ethnic ide ...
(Z/''n''Z)* is equal to ''n''−1, which means that the order of that group is ''n''−1 (because the order of every element of a group divides the order of the group), implying that ''n'' is
prime 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 ways ...
. Conversely, if ''n'' is prime, then there exists a primitive root modulo ''n'', or generator of the group (Z/''n''Z)*. Such a generator has order , (Z/''n''Z)*,  = ''n''−1 and both equivalences will hold for any such primitive root. Note that if there exists an ''a'' < ''n'' such that the first equivalence fails, ''a'' is called a Fermat witness for the compositeness of ''n''.


Example

For example, take ''n'' = 71. Then ''n'' − 1 = 70 and the prime factors of 70 are 2, 5 and 7. We randomly select an ''a=17'' < ''n''. Now we compute: :17^\ \equiv\ 1 \pmod . For all integers ''a'' it is known that :a^\equiv 1 \pmod\ \text \text(a), (n-1). Therefore, the
multiplicative order In number theory, given a positive integer ''n'' and an integer ''a'' coprime to ''n'', the multiplicative order of ''a'' modulo ''n'' is the smallest positive integer ''k'' such that a^k\ \equiv\ 1 \pmod n. In other words, the multiplicative order ...
of 17 (mod 71) is not necessarily 70 because some factor of 70 may also work above. So check 70 divided by its prime factors: :17^\ \equiv\ 70\ \not\equiv\ 1 \pmod :17^\ \equiv\ 25\ \not\equiv\ 1 \pmod :17^\ \equiv\ 1\ \equiv\ 1 \pmod . Unfortunately, we get that 1710≡1 (mod 71). So we still don't know if 71 is prime or not. We try another random ''a'', this time choosing ''a'' = 11. Now we compute: :11^\ \equiv\ 1 \pmod . Again, this does not show that the multiplicative order of 11 (mod 71) is 70 because some factor of 70 may also work. So check 70 divided by its prime factors: :11^\ \equiv\ 70\ \not\equiv\ 1 \pmod :11^\ \equiv\ 54\ \not\equiv\ 1 \pmod :11^\ \equiv\ 32\ \not\equiv\ 1 \pmod . So the multiplicative order of 11 (mod 71) is 70, and thus 71 is prime. (To carry out these
modular exponentiation Modular exponentiation is exponentiation performed over a modulus. It is useful in computer science, especially in the field of public-key cryptography, where it is used in both Diffie-Hellman Key Exchange and RSA public/private keys. Modul ...
s, one could use a fast exponentiation algorithm like
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two digits (0 and 1) * Binary function, a function that takes two arguments * Binary operation, a mathematical operation that ta ...
or addition-chain exponentiation).


Algorithm

The algorithm can be written in pseudocode as follows: algorithm lucas_primality_test is input: ''n'' > 2, an odd integer to be tested for primality. ''k'', a parameter that determines the accuracy of the test. output: ''prime'' if ''n'' is prime, otherwise ''composite'' or ''possibly composite''. determine the prime factors of ''n''−1. LOOP1: repeat ''k'' times: pick ''a'' randomly in the range , ''n'' − 1 return ''composite'' else LOOP2: for all prime factors ''q'' of ''n''−1: if we checked this equality for all prime factors of ''n''−1 then return ''prime'' else continue LOOP2 else continue LOOP1 return ''possibly composite''.


See also

*
Édouard Lucas __NOTOC__ François Édouard Anatole Lucas (; 4 April 1842 – 3 October 1891) was a French mathematician. Lucas is known for his study of the Fibonacci sequence. The related Lucas sequences and Lucas numbers are named after him. Biography Lucas ...
, for whom this test is named * Fermat's little theorem *
Pocklington primality test In mathematics, the Pocklington–Lehmer primality test is a primality test devised by Henry Cabourn Pocklington and Derrick Henry Lehmer. The test uses a partial factorization of N - 1 to prove that an integer N is prime. It produces a prim ...
, an improved version of this test which only requires a partial factorization of ''n'' − 1 *
Primality certificate In mathematics and computer science, a primality certificate or primality proof is a succinct, formal proof that a number is prime. Primality certificates allow the primality of a number to be rapidly checked without having to run an expensive or u ...


Notes

{{number theoretic algorithms Primality tests