Lucas pseudoprimes and Fibonacci pseudoprimes are
composite integers that pass certain tests which all
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 ...
s and very few composite numbers pass: in this case, criteria relative to some
Lucas sequence
In mathematics, the Lucas sequences U_n(P,Q) and V_n(P, Q) are certain constant-recursive integer sequences that satisfy the recurrence relation
: x_n = P \cdot x_ - Q \cdot x_
where P and Q are fixed integers. Any sequence satisfying this rec ...
.
Baillie-Wagstaff-Lucas pseudoprimes
Baillie and Wagstaff define Lucas pseudoprimes as follows:
Given integers ''P'' and ''Q'', where ''P'' > 0 and
,
let ''U
k''(''P'', ''Q'') and ''V
k''(''P'', ''Q'') be the corresponding
Lucas sequence
In mathematics, the Lucas sequences U_n(P,Q) and V_n(P, Q) are certain constant-recursive integer sequences that satisfy the recurrence relation
: x_n = P \cdot x_ - Q \cdot x_
where P and Q are fixed integers. Any sequence satisfying this rec ...
s.
Let ''n'' be a positive integer and let
be 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 ...
. We define
:
If ''n'' is a
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 ...
that does not divide ''Q'', then the following congruence condition holds:
If this congruence does ''not'' hold, then ''n'' is ''not'' prime.
If ''n'' is ''composite'', then this congruence ''usually'' does not hold.
These are the key facts that make Lucas sequences useful in
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 wheth ...
ing.
The congruence () represents one of two congruences defining a
Frobenius pseudoprime. Hence, every Frobenius pseudoprime is also a Baillie-Wagstaff-Lucas pseudoprime, but the converse does not always hold.
Some good references are chapter 8 of the book by Bressoud and Wagon (with
Mathematica
Wolfram (previously known as Mathematica and Wolfram Mathematica) is a software system with built-in libraries for several areas of technical computing that allows machine learning, statistics, symbolic computation, data manipulation, network ...
code),
[
] pages 142–152 of the book by Crandall and Pomerance,
[
] and pages 53–74 of the book by Ribenboim.
[
]
Lucas probable primes and pseudoprimes
A Lucas probable prime for a given (''P, Q'') pair is ''any'' positive integer ''n'' for which equation () above is true (see,
page 1398).
A Lucas pseudoprime for a given (''P, Q'') pair is a positive ''composite'' integer ''n'' for which equation () is true (see,
page 1391).
A Lucas probable prime test is most useful if ''D'' is chosen such that the Jacobi symbol
is −1
(see pages 1401–1409 of,
page 1024 of,
or pages 266–269 of
). This is especially important when combining a Lucas test with a
strong pseudoprime
Strong may refer to:
Education
* The Strong, an educational institution in Rochester, New York, United States
* Strong Hall (Lawrence, Kansas), an administrative hall of the University of Kansas
* Strong School, New Haven, Connecticut, United ...
test, such as the
Baillie–PSW primality test
The Baillie–PSW primality test is a probabilistic or possibly deterministic 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, ...
. Typically implementations will use a parameter selection method that ensures this condition (e.g. the Selfridge method recommended in
and described below).
If
then equation () becomes
If congruence () is false, this constitutes a proof that ''n'' is composite.
If congruence () is true, then ''n'' is a Lucas probable prime.
In this case, either ''n'' is prime or it is a Lucas pseudoprime.
If congruence () is true, then ''n'' is ''likely'' to be prime (this justifies the term probable prime), but this does not ''prove'' that ''n'' is prime.
As is the case with any other probabilistic primality test, if we perform additional Lucas tests with different ''D'', ''P'' and ''Q'', then unless one of the tests proves that ''n'' is composite, we gain more confidence that ''n'' is prime.
Examples: If ''P'' = 3, ''Q'' = −1, and ''D'' = 13, the sequence of ''Us is : ''U
0'' = 0, ''U
1'' = 1, ''U
2'' = 3, ''U
3'' = 10, etc.
First, let ''n'' = 19. The Jacobi symbol
is −1, so δ(''n'') = 20, ''U
20'' = 6616217487 = 19·348221973 and we have
:
Therefore, 19 is a Lucas probable prime for this (''P, Q'') pair. In this case 19 is prime, so it is ''not'' a Lucas pseudoprime.
For the next example, let ''n'' = 119. We have
= −1, and we can compute
:
However, 119 = 7·17 is not prime, so 119 is a Lucas ''pseudoprime'' for this (''P, Q'') pair.
In fact, 119 is the smallest pseudoprime for ''P'' = 3, ''Q'' = −1.
We will see
below
Below may refer to:
*Earth
*Ground (disambiguation)
*Soil
*Floor
* Bottom (disambiguation)
*Less than
*Temperatures below freezing
*Hell or underworld
People with the surname
* Ernst von Below (1863–1955), German World War I general
* Fred Belo ...
that, in order to check equation () for a given ''n'', we do ''not'' need to compute all of the first ''n'' + 1 terms in the ''U'' sequence.
Let ''Q'' = −1, the smallest Lucas pseudoprime to ''P'' = 1, 2, 3, ... are
:323, 35, 119, 9, 9, 143, 25, 33, 9, 15, 123, 35, 9, 9, 15, 129, 51, 9, 33, 15, 21, 9, 9, 49, 15, 39, 9, 35, 49, 15, 9, 9, 33, 51, 15, 9, 35, 85, 39, 9, 9, 21, 25, 51, 9, 143, 33, 119, 9, 9, 51, 33, 95, 9, 15, 301, 25, 9, 9, 15, 49, 155, 9, 399, 15, 33, 9, 9, 49, 15, 119, 9, ...
Strong Lucas pseudoprimes
Now, factor
into the form
where
is odd.
A strong Lucas pseudoprime for a given (''P'', ''Q'') pair is an odd composite number ''n'' with GCD(''n, D'') = 1, satisfying one of the conditions
:
or
:
for some 0 ≤ ''r'' < ''s''; see page 1396 of.
A strong Lucas pseudoprime is also a Lucas pseudoprime (for the same (''P'', ''Q'') pair), but the converse is not necessarily true.
Therefore, the strong test is a more stringent primality test than equation ().
There are infinitely many strong Lucas pseudoprimes, and therefore, infinitely many Lucas pseudoprimes.
Theorem 7 in
states: Let
and
be relatively prime positive integers for which
is positive but not a square. Then there is a positive constant
(depending on
and
) such that the number of strong Lucas pseudoprimes not exceeding
is greater than
, for
sufficiently large.
We can set ''Q'' = −1, then
and
are ''P''-Fibonacci sequence and ''P''-Lucas sequence, the pseudoprimes can be called strong Lucas pseudoprime in base ''P'', for example, the least strong Lucas pseudoprime with ''P'' = 1, 2, 3, ... are 4181, 169, 119, ...
An extra strong Lucas pseudoprime
[ cited in ]
is a strong Lucas pseudoprime for a set of parameters (''P'', ''Q'') where ''Q'' = 1, satisfying one of the conditions
:
or
:
for some
. An extra strong Lucas pseudoprime is also a strong Lucas pseudoprime for the same
pair. No number can be a strong Lucas pseudoprime to more than of all bases, or an extra strong Lucas pseudoprime to more than of all bases.
Implementing a Lucas probable prime test
Before embarking on a probable prime test, one usually verifies that ''n'', the number to be tested for primality, is odd, is not a perfect square, and is not divisible by any small prime less than some convenient limit. Perfect squares are easy to detect using
Newton's method
In numerical analysis, the Newton–Raphson method, also known simply as Newton's method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a ...
for square roots.
We choose a Lucas sequence where the Jacobi symbol
, so that δ(''n'') = ''n'' + 1.
Given ''n'', one technique for choosing ''D'' is to use trial and error to find the first ''D'' in the sequence 5, −7, 9, −11, ... such that
. Note that
.
(If ''D'' and ''n'' have a prime factor in common, then
).
With this sequence of ''D'' values, the average number of ''D'' values that must be tried before we encounter one whose Jacobi symbol is −1 is about 1.79.
Once we have ''D'', we set
and
.
It is a good idea to check that ''n'' has no prime factors in common with ''P'' or ''Q''.
This method of choosing ''D'', ''P'', and ''Q'' was suggested by
John Selfridge
John Lewis Selfridge (February 17, 1927 – October 31, 2010) was an American mathematician who contributed to the fields of analytic number theory, computational number theory, and combinatorics.
Education
Selfridge received his Ph.D. in ...
.
(This search will never succeed if ''n'' is square, and conversely if it does succeed, that is proof that ''n'' is not square. Thus, some time can be saved by delaying testing ''n'' for squareness until after the first few search steps have all failed.)
Given ''D'', ''P'', and ''Q'', there are recurrence relations that enable us to quickly compute
and
in
steps; see . To start off,
:
:
:
First, we can double the subscript from
to
in one step using the recurrence relations
:
:
:
Next, we can increase the subscript by 1 using the recurrences
:
:
:
At each stage, we reduce all of the variables modulo ''n''. When dividing by 2
modulo
In computing and mathematics, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another, the latter being called the '' modulus'' of the operation.
Given two positive numbers and , mo ...
''n'', if the numerator is odd add ''n'' (which does not change the value modulo ''n'') to make it even before dividing by 2.'
We use the bits of the binary expansion of ''n'' to determine ''which'' terms in the sequence to compute. For example, if ''n''+1 = 44 (= 101100 in binary), then, taking the bits one at a time from left to right, we obtain the sequence of indices to compute: 1
2 = 1, 10
2 = 2, 100
2 = 4, 101
2 = 5, 1010
2 = 10, 1011
2 = 11, 10110
2 = 22, 101100
2 = 44. Therefore, we compute ''U''
1, ''U''
2, ''U''
4, ''U''
5, ''U''
10, ''U''
11, ''U''
22, and ''U''
44. We also compute the same-numbered terms in the ''V'' sequence, along with ''Q''
1, ''Q''
2, ''Q''
4, ''Q''
5, ''Q''
10, ''Q''
11, ''Q''
22, and ''Q''
44.
By the end of the calculation, we will have computed ''U
n+1'', ''V
n+1'', and ''Q
n+1'', (mod ''n'').
We then check congruence () using our expected value of ''U
n+1''.
When the parameters ''D'', ''P'', and ''Q'' are chosen as described above, the first 10 Lucas pseudoprimes are:
323, 377, 1159, 1829, 3827, 5459, 5777, 9071, 9179, and 10877
The strong versions of the Lucas test can be implemented in a similar way. With the same parameters, the first 10 ''strong'' Lucas pseudoprimes are: 5459, 5777, 10877, 16109, 18971, 22499, 24569, 25199, 40309, and 58519
''Extra strong'' Lucas pseudoprimes use different parameters: fix
.
Then try ''P'' = 3, 4, 5, 6, ..., until a value of
is found so that the Jacobi symbol
. The first 10 ''extra strong'' Lucas pseudoprimes are
989, 3239, 5777, 10877, 27971, 29681, 30739, 31631, 39059, and 72389
Checking additional congruence conditions
If we have checked that congruence () is true, there are additional congruence conditions we can check that have almost no additional computational cost. By providing an additional opportunity for ''n'' to be proved composite, these increase the reliability of the test.
If ''n'' is an odd prime and
, then we have the following:
Although this congruence condition is not part of the Lucas probable prime test proper, it is almost free to check this condition because, as noted above, the easiest way to compute ''U''
''n''+1 is to compute ''V''
''n''+1 as well.
If Selfridge's method (above) for choosing parameters is modified so that, if it selects ''D'' = 5, it uses the parameters ''P'' = ''Q'' = 5 rather than ''P'' = 1, ''Q'' = −1, then 913 = 11·83 is the ''only'' composite less than 10
8 for which congruence () is true (see page 1409 and Table 6 of;
). More extensive calculations show that, with this method of choosing ''D'', ''P'', and ''Q'', there are only five odd, composite numbers less than 10
15 for which congruence () is true.
If
(and GCD(''n'', ''Q'') = 1), then an
Euler–Jacobi probable prime test to the base Q can also be implemented at minor computational cost.
The computation of
depends on
and
. This is
times
, and if ''n'' is prime, then by
Euler's criterion
In number theory, Euler's criterion is a formula for determining whether an integer is a quadratic residue modulo a prime. Precisely,
Let ''p'' be an odd prime and ''a'' be an integer coprime to ''p''. Then
:
a^ \equiv
\begin
\;\;\,1\pmod& \text ...
,
:
.
(Here,
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 of an odd prime number ''p'': its value at a (nonzero) quadratic residue mod ''p'' is 1 and at a non-quadratic re ...
; if ''n'' is prime, this is the same as the Jacobi symbol).
Therefore, if ''n'' is prime, we must have,
The Jacobi symbol on the right side is easy to compute, so this congruence is easy to check.
If this congruence does not hold, then ''n'' cannot be prime. Provided GCD(''n, Q'') = 1 then testing for congruence () is equivalent to augmenting our Lucas test with a "base Q"
Solovay–Strassen primality test.
There is one more congruence condition on
and
which must be true if ''n'' is prime and can be checked.
Comparison with the Miller–Rabin primality test
''k'' applications of 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 pr ...
declare a composite ''n'' to be probably prime with a probability at most (1/4)
''k''.
There is a similar probability estimate for the strong Lucas probable prime test.
Aside from two trivial exceptions (see below), the fraction of (''P'',''Q'') pairs (modulo ''n'') that declare a composite ''n'' to be probably prime is at most (4/15).
Therefore, ''k'' applications of the strong Lucas test would declare a composite ''n'' to be probably prime with a probability at most (4/15)
k.
There are two trivial exceptions. One is ''n'' = 9. The other is when ''n'' = ''p''(''p''+2) is the product of two
twin prime
A twin prime is a prime number that is either 2 less or 2 more than another prime number—for example, either member of the twin prime pair or In other words, a twin prime is a prime that has a prime gap of two. Sometimes the term ''twin prime' ...
s. Such an ''n'' is easy to factor, because in this case, ''n''+1 = (''p''+1)
2 is a perfect square. One can quickly detect perfect squares using
Newton's method
In numerical analysis, the Newton–Raphson method, also known simply as Newton's method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a ...
for square roots.
By combining a Lucas pseudoprime test with a
Fermat primality test, say, to base 2, one can obtain very powerful probabilistic tests for primality, such as the
Baillie–PSW primality test
The Baillie–PSW primality test is a probabilistic or possibly deterministic 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, ...
.
Fibonacci pseudoprimes
When ''P'' = 1 and ''Q'' = −1, the ''U
n''(''P'',''Q'') sequence represents the Fibonacci numbers.
A Fibonacci pseudoprime is often
defined as a composite number ''n'' not divisible by 5 for which congruence () holds with ''P'' = 1 and ''Q'' = −1. By this definition, the Fibonacci pseudoprimes form a sequence:
: 323, 377, 1891, 3827, 4181, 5777, 6601, 6721, 8149, 10877, ... .
The references of Anderson and Jacobsen below use this definition.
If ''n'' is congruent to 2 or 3 modulo 5, then Bressoud,
and Crandall and Pomerance
point out that it is rare for a Fibonacci pseudoprime to also be a
Fermat pseudoprime base 2. However, when ''n'' is congruent to 1 or 4 modulo 5, the opposite is true, with over 12% of Fibonacci pseudoprimes under 10
11 also being base-2 Fermat pseudoprimes.
If ''n'' is prime and GCD(''n'', ''Q'') = 1, then we also have
This leads to an alternative definition of Fibonacci pseudoprime:
: a Fibonacci pseudoprime is a composite number ''n'' for which congruence () holds with ''P'' = 1 and ''Q'' = −1.
This definition leads the Fibonacci pseudoprimes form a sequence:
: 705, 2465, 2737, 3745, 4181, 5777, 6721, 10877, 13201, 15251, ... ,
which are also referred to as ''Bruckman-Lucas'' pseudoprimes.
Hoggatt and Bicknell studied properties of these pseudoprimes in 1974. Singmaster computed these pseudoprimes up to 100000. Jacobsen lists all 111443 of these pseudoprimes less than 10
13.
It has been shown that there are no even Fibonacci pseudoprimes as defined by equation (5).
However, even Fibonacci pseudoprimes do exist under the first definition given by ().
A strong Fibonacci pseudoprime is a composite number ''n'' for which congruence () holds for ''Q'' = −1 and all ''P''.
It follows
that an odd composite integer ''n'' is a strong Fibonacci pseudoprime if and only if:
#''n'' is a
Carmichael number
In number theory, a Carmichael number is a composite number which in modular arithmetic satisfies the congruence relation:
: b^n\equiv b\pmod
for all integers . The relation may also be expressed in the form:
: b^\equiv 1\pmod
for all integers b ...
#2(''p'' + 1) , (''n'' − 1) or 2(''p'' + 1) , (''n'' − ''p'') for every prime ''p'' dividing ''n''.
The smallest example of a strong Fibonacci pseudoprime is 443372888629441 = 17·31·41·43·89·97·167·331.
Pell pseudoprimes
A Pell pseudoprime may be defined as a composite number ''n'' for which equation () above is true with ''P'' = 2 and ''Q'' = −1; the sequence ''U
n'' then being the
Pell sequence. The first pseudoprimes are then 35, 169, 385, 779, 899, 961, 1121, 1189, 2419, ...
This differs from the definition in which may be written as:
:
with (''P'', ''Q'') = (2, −1) again defining ''U
n'' as the
Pell sequence. The first pseudoprimes are then 169, 385, 741, 961, 1121, 2001, 3827, 4879, 5719, 6215 ...
A third definition uses equation (5) with (''P'', ''Q'') = (2, −1), leading to the pseudoprimes 169, 385, 961, 1105, 1121, 3827, 4901, 6265, 6441, 6601, 7107, 7801, 8119, ...
References
External links
* Anderson, Peter G
Fibonacci Pseudoprimes, their factors, and their entry points.* Anderson, Peter G
Fibonacci Pseudoprimes under 2,217,967,487 and their factors.* Jacobsen, Dan
(data for Lucas, Strong Lucas, AES Lucas, ES Lucas pseudoprimes below 10
14; Fibonacci and Pell pseudoprimes below 10
12)
*
*
*
*
{{Classes of natural numbers
Fibonacci numbers
Pseudoprimes