This article explains the general test of prime numbers for natural numbers
n , discovered by Édouard Lucas , for which the factorization of n - 1 is known. The (independent) prime number test for Mersenne numbers can be found in the article Lucas-Lehmer test .
The Lucas test is a further development of Fermat's primality test by the mathematician Édouard Lucas . The test was improved in the 1950s by Derrick Henry Lehmer and later again by John Brillhart and John L. Selfridge . It should not be confused with the Lucas-Lehmer test for Mersenne numbers .
Fermatscher primality test
A natural number is given , for which one would like to check whether it is prime. According to the Fermat's primality test is not a prime number if the following condition for too relatively prime number with true:
![n> 1](https://wikimedia.org/api/rest_v1/media/math/render/svg/ee74e1cc07e7041edf0fcbd4481f5cd32ad17b64)
![n](https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b)
![n](https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b)
![a](https://wikimedia.org/api/rest_v1/media/math/render/svg/ffd2487510aa438433a2579450ab2b3d557e5edc)
![1 <a <n](https://wikimedia.org/api/rest_v1/media/math/render/svg/f79d187354dd66638b54b4ffa948cb197886cc5a)
![{\ displaystyle a ^ {n-1} \ not \ equiv 1 {\ pmod {n}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/815e1cde47b2d07520bc906454239520561c96b5)
The Fermat test never provides the statement that a number is prime, but can only rule out being prime. The Fermat test does not provide any information about the Carmichael numbers .
Lucas test
In 1876, Édouard Lucas succeeded in reversing Fermat's little sentence:
(Forerunner of the Lucas test) A natural number is a prime number if and only if there is a with for that
![n](https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b)
![a](https://wikimedia.org/api/rest_v1/media/math/render/svg/ffd2487510aa438433a2579450ab2b3d557e5edc)
![1 <a <n](https://wikimedia.org/api/rest_v1/media/math/render/svg/f79d187354dd66638b54b4ffa948cb197886cc5a)
![{\ displaystyle a ^ {n-1} \ equiv 1 {\ pmod {n}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/3bfc8625369c7558deadd61823842db06983423d)
such as
![{\ displaystyle a ^ {m} \ not \ equiv 1 {\ pmod {n}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a8a3850cd6dd882db3e238bfb3df77085eeaaf64)
holds for all natural numbers .
![{\ displaystyle m <n-1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/8812fd8c13c02838e964427b226790831d8ba0d8)
This finding is difficult to apply because there are so many to test. In 1891 Lucas corrected the sentence and received the prime number test named after him:
![m](https://wikimedia.org/api/rest_v1/media/math/render/svg/0a07d98bb302f3856cbabc47b2b9016692e3f7bc)
(Lucas test) A natural number is a prime number if and only if there is a with for that
![n](https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b)
![a](https://wikimedia.org/api/rest_v1/media/math/render/svg/ffd2487510aa438433a2579450ab2b3d557e5edc)
![1 <a <n](https://wikimedia.org/api/rest_v1/media/math/render/svg/f79d187354dd66638b54b4ffa948cb197886cc5a)
![{\ displaystyle a ^ {n-1} \ equiv 1 {\ pmod {n}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/3bfc8625369c7558deadd61823842db06983423d)
such as
![{\ displaystyle a ^ {m} \ not \ equiv 1 {\ pmod {n}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a8a3850cd6dd882db3e238bfb3df77085eeaaf64)
holds for all real divisors of .
![{\ displaystyle m <n-1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/8812fd8c13c02838e964427b226790831d8ba0d8)
![n-1](https://wikimedia.org/api/rest_v1/media/math/render/svg/fbd0b0f32b28f51962943ee9ede4fb34198a2521)
Since only the divisors of have to be tested here, considerably fewer calculation steps are necessary. A disadvantage, however, is that you have to know the prime factorization of . must therefore be factored . However, this method is very efficient for numbers with a special structure, for example numbers of the form .
![n-1](https://wikimedia.org/api/rest_v1/media/math/render/svg/fbd0b0f32b28f51962943ee9ede4fb34198a2521)
![n-1](https://wikimedia.org/api/rest_v1/media/math/render/svg/fbd0b0f32b28f51962943ee9ede4fb34198a2521)
![n-1](https://wikimedia.org/api/rest_v1/media/math/render/svg/fbd0b0f32b28f51962943ee9ede4fb34198a2521)
![{\ displaystyle 2 ^ {k} +1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/37106849bec61399f55dd477a364a2b2bfbb8bf7)
If the condition of the Lucas test for a basis is not fulfilled, it does not follow that the number is composed. For that you would have to check all bases .
![a](https://wikimedia.org/api/rest_v1/media/math/render/svg/ffd2487510aa438433a2579450ab2b3d557e5edc)
![n](https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b)
![1 <a <n](https://wikimedia.org/api/rest_v1/media/math/render/svg/f79d187354dd66638b54b4ffa948cb197886cc5a)
Example:
The following applies to the number . The real dividers of are and . Further applies and . It follows that is a prime number.
![{\ displaystyle n = 59}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a72285f96af49ef60600ab41c6b6a931d90e4bb0)
![{\ displaystyle 2 ^ {58} \ equiv 1 \ mod \ 59}](https://wikimedia.org/api/rest_v1/media/math/render/svg/3af0ab29eeefb1d940cd6853e5d5d7f1a4e0a4dd)
![{\ displaystyle n-1 = 58}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4c0d6bf1d6fbaffd8afc6fa6c781c70103f03efd)
![1, 2](https://wikimedia.org/api/rest_v1/media/math/render/svg/acd303e64654e923bd5ea3ef1a4e3f1e2d3e58ed)
![29](https://wikimedia.org/api/rest_v1/media/math/render/svg/c7da87a63c962a07867681e0ef399d022c7f05ec)
![{\ displaystyle 2 ^ {1} \ equiv 2 \ mod \ 59.2 ^ {2} \ equiv 4 \ mod \ 59}](https://wikimedia.org/api/rest_v1/media/math/render/svg/868feb85b0621e61cc246e3a115cc84fff9e7935)
![{\ displaystyle 2 ^ {29} \ equiv -1 \ mod \ 59}](https://wikimedia.org/api/rest_v1/media/math/render/svg/181fdccf0bfb5b250ad59a5a7619c23a83d5e69f)
![{\ displaystyle 59}](https://wikimedia.org/api/rest_v1/media/math/render/svg/566ac8d785505c91c8d7db51fbf641a6467fcdbd)
Extensions by Lehmer, Brillhart and Selfridge
Derrick Henry Lehmer found the improved Lucas test in 1953 . In 1967 another version ( flexible Lucas test ) was discovered by John Brillhart and John L. Selfridge .
Improved Lucas test
The improved Lucas test is based on the following property: is a prime number if and only if there is a natural number with for which
![n](https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b)
![a](https://wikimedia.org/api/rest_v1/media/math/render/svg/ffd2487510aa438433a2579450ab2b3d557e5edc)
![1 <a <n](https://wikimedia.org/api/rest_v1/media/math/render/svg/f79d187354dd66638b54b4ffa948cb197886cc5a)
![{\ displaystyle a ^ {n-1} \ equiv 1 {\ pmod {n}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/3bfc8625369c7558deadd61823842db06983423d)
such as
![{\ displaystyle a ^ {\ frac {n-1} {q_ {i}}} \ not \ equiv 1 {\ pmod {n}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/3b79aab5446b897120d778747dda9957c2912040)
for all prime factors of .
![q_ {i}](https://wikimedia.org/api/rest_v1/media/math/render/svg/2752dcbff884354069fe332b8e51eb0a70a531b6)
![n-1](https://wikimedia.org/api/rest_v1/media/math/render/svg/fbd0b0f32b28f51962943ee9ede4fb34198a2521)
The application of this test to Fermat numbers is called the Pépin test .
Flexible Lucas test
The flexible Lucas test is based on the following property:
The prime factorization of the natural number is given by
![n](https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b)
![n-1](https://wikimedia.org/api/rest_v1/media/math/render/svg/fbd0b0f32b28f51962943ee9ede4fb34198a2521)
-
.
Then the following applies: is a prime number if and only if there is a natural number with for every prime factor for which
![n](https://wikimedia.org/api/rest_v1/media/math/render/svg/a601995d55609f2d9f5e233e36fbe9ea26011b3b)
![q_ {i}](https://wikimedia.org/api/rest_v1/media/math/render/svg/2752dcbff884354069fe332b8e51eb0a70a531b6)
![a_ {i}](https://wikimedia.org/api/rest_v1/media/math/render/svg/0bc77764b2e74e64a63341054fa90f3e07db275f)
![{\ displaystyle 1 <a_ {i} <n}](https://wikimedia.org/api/rest_v1/media/math/render/svg/078d47488174faf0137d61b389e1947d8f931922)
![{\ displaystyle a_ {i} ^ {n-1} \ equiv 1 {\ pmod {n}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/92becea2205f5cd8b8cbc154948073bd0c24ed13)
such as
![{\ displaystyle a_ {i} ^ {\ frac {n-1} {q_ {i}}} \ not \ equiv 1 {\ pmod {n}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/159ba9817a016bce13865b8c9f0031c98b99af94)
applies.
example
We consider the prime number . The previous number has the prime divisors and . The following table shows suitable and how the conditions are met:
![{\ displaystyle n = 911}](https://wikimedia.org/api/rest_v1/media/math/render/svg/cf22ca467850ec4bcdcc9b00e675d2109474fcc4)
![{\ displaystyle n-1 = 910}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9ce1cf847fd2a63c8769ba016c22561a95085753)
![{\ displaystyle q = 2,5,7}](https://wikimedia.org/api/rest_v1/media/math/render/svg/67c6a4eb4e0f5d27564ef873a1b45a0d4756a48a)
![13](https://wikimedia.org/api/rest_v1/media/math/render/svg/d478c234d544278fb494e9610b7b3310567302b0)
![a](https://wikimedia.org/api/rest_v1/media/math/render/svg/ffd2487510aa438433a2579450ab2b3d557e5edc)
q |
a |
a n-1 ≡ 1 (mod n) |
a (n-1) / q ≢ 1 (mod n)
|
2 |
7th |
7 910 ≡ 1 (mod 911) |
7 910/2 ≡ -1 (mod 911)
|
5 |
3 |
3 910 ≡ 1 (mod 911) |
3 910/5 ≡ 482 (mod 911)
|
7th |
2 |
2 910 ≡ 1 (mod 911) |
2 910/7 ≡ 568 (mod 911)
|
13 |
2 |
2 910 ≡ 1 (mod 911) |
2 910/13 ≡ 577 (mod 911)
|
Pratt prime number test
The Pratt test is an iterated Lucas test. In turn, it is checked for all prime factors of whether these are prime numbers.
![n-1](https://wikimedia.org/api/rest_v1/media/math/render/svg/fbd0b0f32b28f51962943ee9ede4fb34198a2521)
Fermat couple
is a Fermat pair if
Pratt sequence
is a Pratt sequence if for each Fermat pair from the sequence it is true that for each prime factor of a Fermat pair is contained in the Pratt sequence and the following applies:![(from)](https://wikimedia.org/api/rest_v1/media/math/render/svg/d7e5710198f33b00695903460983021e75860e2c)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![b](https://wikimedia.org/api/rest_v1/media/math/render/svg/f11423fbb2e967f986e36804a8ae4271734917c3)
![{\ displaystyle (a ', p)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/92462b8e434173593a56b2958be0cd3956cfeed8)
For every prime number there is a Pratt sequence the length of the representation of the prime number, which is why .
![{\ displaystyle Prime \ in NP}](https://wikimedia.org/api/rest_v1/media/math/render/svg/66dce1ca67d70f74694792ec34a1af8b1db211ee)
example
For the following is a possible Pratt sequence
![{\ displaystyle 797}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f35b4592083541e6540ed5453d2c2cd6148148eb)
to check is now even whether , and on whether the prime divisors of true![{\ displaystyle a ^ {b-1} \ equiv 1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/18a2b81176fcf38781d4c6d9bd67de456d58c7f9)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![{\ displaystyle b-1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/1bf4269308d5f8175c0de6c3d7d9dc177e4f1cae)
literature
Individual evidence
-
↑ Proof of this: see Ribenboim, Die Welt der Prime Numbers , page 40.
-
↑ To prove this and the previous theorem, see Ribenboim, Die Welt der Prime Numbers , page 42.
-
^ Daniela Steidl: Pratt certificate of prime numbers. April 17, 2008, accessed May 7, 2020 .
-
↑ apl. Prof. Dr. Klaus Reinhardt: Pratt prime number test. Retrieved on May 7, 2020 (German, English).