In
number theory
Number theory is a branch of pure mathematics devoted primarily to the study of the integers and arithmetic functions. Number theorists study prime numbers as well as the properties of mathematical objects constructed from integers (for example ...
, Proth's theorem is a theorem which forms the basis of a
primality test for
Proth numbers (sometimes called Proth Numbers of the First Kind). For ''Proth Numbers of the Second Kind'', see
Riesel numbers.
It states that for any
integer
An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
''p'' that is a Proth number (of the first kind) - an integer of the form ''k''2
''n'' + 1 with ''k'' odd and ''k'' < 2
''n'' - and if there exists an integer ''a'' for which
Euler's criterion is ''-1'', thus:
:
then ''p'' 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 ...
. In this case, ''p'' is called a Proth prime. The
contrapositive
In logic and mathematics, contraposition, or ''transposition'', refers to the inference of going from a Conditional sentence, conditional statement into its logically equivalent contrapositive, and an associated proof method known as . The contrap ...
is also true: if ''p'' is composite then no such ''a'' exists.
It might be noted that the presumption of ''k'' being odd does not restrict generality. So long as the condition that ''k'' < 2
''n'' is met, any factors of 2 in an even ''k'' may be factored out of ''k'' and into 2
''n'', growing the latter while shrinking the former even further; the inequality condition remains true. Thus, ''k'' may always be reduced to an odd value, suitable for analyses.
Proth's Test
Only one such value of ''a'' need be found for the test to deterministically confirm primality, provided that ''p'' is a Proth number. This is a practical test because if ''p'' is prime, any chosen ''a'' has about a 50 percent chance of working, and if ''p'' is not prime then no chosen ''a'' will work. Furthermore, since the calculation is ''mod p'', only values of ''a'' smaller than ''p'' have to be taken into consideration.
Systematic naive variant
If ''p'' is composite then no base ''a'' will work to bear witness of primality. As such, we may check all base values
,''p''−1to verify compositeness (note that ''a''=0 and ''a''=1 will never work). If any one base ''a'' bears witness then primality is confirmed. If none do then compositeness is confirmed. This process, however, can be made more efficient.
In principle, since if ''p'' is prime, there is roughly a 50% chance of a chosen ''a'' of proving primality, we may make the process slightly more efficient by checking about one-half of all possible ''a'' values smaller than ''p''. Once more than ''p''/2 distinct values of ''a'' have been tested, compositeness is deterministic. This is because if ''p'' is prime then we expect half of all bases to bears witness; by the
pigeonhole principle
In mathematics, the pigeonhole principle states that if items are put into containers, with , then at least one container must contain more than one item. For example, of three gloves, at least two must be right-handed or at least two must be l ...
once more than half have been checked we can deduce that none will bear witness, and if no base value ''a'' will work then ''p'' is composite. If ''p'' is prime then at least one of the values checked would inevitably have bore witness, as would all remaining unchecked values. This variation of the test – akin to the deterministic variant of the
Fermat primality test – is grossly inefficient and never employed.
Probabilistic Monte Carlo Variant
As 50% of bases ''a'' are expected to bear witness to primality, if ''p'' is indeed prime, we may form a
Monte Carlo
Monte Carlo ( ; ; or colloquially ; , ; ) is an official administrative area of Monaco, specifically the Ward (country subdivision), ward of Monte Carlo/Spélugues, where the Monte Carlo Casino is located. Informally, the name also refers to ...
probabilistic test thus: if the test is repeatedly performed an ''m'' number of times, each iteration with a random ''a'', each time failing to confirm primality, then we may infer that ''p'' is ''probably composite'' (contrary to the ''probably prime'' results typical of other Monte Carlo algorithms such as the
Miller-Rabin test). An approximate upper bound error probability
of a prime being falsely identified as composite can also be inferred. A composite will, however, never be falsely identified as prime. This probabilistic implementation is not typically performed; even though it is far more efficient than the deterministic test, it can be improved both in performance runtime and in accuracy.
Las Vegas Variant
In practice, a
quadratic nonresidue of ''p'' is found and taken as the value of ''a'', since if ''a'' is a quadratic nonresidue modulo ''p'' then the
converse is also true, and the test is conclusive. For such an ''a'' 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 ...
is
::
For such a value of ''a'' the test is deterministic in both primeness and compositeness, thus for such an ''a'' the check against Proth's criteria only requires one iteration.
The value of ''a'' may be found by systematically checking values in the interval
, ''p''−1 through random selection and checking, or by a more direct computation. If no quadratic nonresidual can be found then compositeness may be inferred. When a value of ''a'' is verified against the Legendre symbol as a valid candidate, it may be used in Proth's criteria to determine primeness or compositeness conclusively.
This formulation of the test is by far the most efficient, particularly where a quadratic nonresidual is calculated directly, which can be done via a
modified Euclid's algorithm. .
Thus, in contrast to many Monte Carlo
primality tests (randomized algorithms that can return a
false positive or
false negative), this deterministic variant of the primality testing algorithm is a
Las Vegas algorithm
In computing, a Las Vegas algorithm is a randomized algorithm that always gives Correctness (computer science), correct results; that is, it always produces the correct result or it informs about the failure. However, the runtime of a Las Vegas alg ...
, always returning the correct answer but with a randomly varying
runtime. The check against Proth's criteria has a runtime on the order of a constant; the random variability in the overall test runtime is primality a result of the search for an appropriate ''a'' value, however that may be done.
Simplified forms
Given a Proth number of the form ''p'' = ''k''2
''n'' + 1, particular forms of either ''p'', ''k'', or ''n'' have been identified that correspond to predetermined quadratic nonresidual values that are appropriate for use. It has been shown that:
* If ''p''>3 and
, then ''a''=3 is always a quadratic nonresidual (candidate) and therefore a valid base to check, and so:
::
if and only if ''p'' is prime.
: This is the basis of
Pépin's test for
Fermat number
In mathematics, a Fermat number, named after Pierre de Fermat (1601–1665), the first known to have studied them, is a natural number, positive integer of the form:F_ = 2^ + 1, where ''n'' is a non-negative integer. The first few Fermat numbers ...
s and their corresponding primes, wherein ''k''=1 is indivisible by 3.
* If ''p''>5 and
, then ''a''=5 is always a quadratic nonresidual (candidate) and therefore a valid base to check, and so:
::
if and only if ''p'' is prime.
Numerical examples
Examples of the theorem include:
* for ''p'' = 3 = 1(2
1) + 1, we have that 2
(3−1)/2 + 1 = 3 is divisible by 3, so 3 is prime.
* for ''p'' = 5 = 1(2
2) + 1, we have that 3
(5−1)/2 + 1 = 10 is divisible by 5, so 5 is prime.
* for ''p'' = 13 = 3(2
2) + 1, we have that 5
(13−1)/2 + 1 = 15626 is divisible by 13, so 13 is prime.
* for ''p'' = 9, which is not prime, there is no ''a'' such that ''a''
(9−1)/2 + 1 is divisible by 9.
The fact that ''p''=9 is not prime can be deterministically verified by checking that no such ''a'' (in mod 9) exists. This may be done by systematically checking each value of ''a'' from 2 to 8 (''a''=0 and ''a''=1 will never work). It is however sufficient to check values 2 to 5, or one-half of all possible values under 9. If 9 were a prime then by the pigeonhole principle, at lease one of these values of ''a'' will confirm primality, since it is expected that half of them would.
Alternatively, if we employ the deterministic variant wherein the quadratic nonresidual is directly computed, the work requires fewer iterations to confirm both compositeness and primality.
* for ''p'' = 97 = 3(2
5) + 1, we have a quadratic nonresidual of ''a''=5, and that 5
(97−1)/2 + 1 = 3552713678800500929355621337890626 is divisible by 97, so 97 is prime.
* for ''p'' = 1537 = 3(2
9) + 1, we have a quadratic nonresidual of ''a''=5, and that 5
(1537−1)/2 + 1 = 1052 (mod 1537) is not divisible by 1537, so 1537=29×53 is not prime.
In each of the previous two examples, an appropriate value of ''a'' was directly computed using a quadratic nonresidual computation such that the results of the test would be conclusive - a valid quadratic nonresidual in both the prime and composite cases. It was not necessarily to systematically search for an ''a'' to witness the prime case, or to reiterate the test a sufficient number of times for the composite. If a quadratic nonresidual cannot be found, or if one does not exist, we may take this as confirmation of compositeness.
Alternative Testing Results
Euler's criterion provides additional insights to a number ''p'', which are not necessarily components of Proth's theorem. These are secondary facts largely attributed to other theorems, which are trivially evaluated during any implementation of Proth's test. The number ''p'' need not be a Proth number for the criterion to be useful. Given a integer ''p'', let us choose an arbitrary ''a'' value. Evaluate Euler's criterion:
:
,
There are generally five distinct outcomes. Some of these results do not rely on ''p'' being a Proth number, and are therefore valid for any form of prime candidate.
Conclusive primality of ''p'':
* ''b = −1'', in which case Proth's criteria is met and ''p'' is confirmed to be a Proth prime, as per Proth's theorem, if indeed ''p'' is a Proth number.
: If ''p'' is not a Proth number yet ''b = −1'', this is indicative, but not conclusive, of primality. Refer to the probabilistic
Solovay–Strassen primality test and the
Miller-Rabin test.
Inconclusive result:
* ''b = 1'', in which case the test is inconclusive and must be tried again with a new ''a'' value.
: This condition is what requires reiteration and makes the test probabilistic, as if ''p'' were prime then ''b = ±1'' occurs with roughly equal probability, though the ''b = 1'' condition may still be met with ''p'' either composite or non-Proth.
Conclusive compositeness of ''p'', as per Euler's criterion and 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 ...
, which offer early exit conditions when ''b ≠ ±1''. In each of these cases ''p'' is not prime and also need not be a Proth number:
* ''b
2 = 1'', with nontrivial divisors of ''p'' being ''GCD(b ± 1, p)''.
* ''b
2 ≠ 1'', where ''p'' is proven composite by Fermat's test, base ''a''.
* ''b = 0'', where ''p'' has a nontrivial divisor ''GCD(a, p)''.
:Where ''GCD(x, y)'' is the
greatest common divisor
In mathematics, the greatest common divisor (GCD), also known as greatest common factor (GCF), of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers. For two integers , , the greatest co ...
between integers ''x'' and ''y''.
Prime Search
The first Proth primes are :
:3, 5, 13, 17,
41,
97,
113,
193, 241, 257, 353, 449, 577, 641, 673, 769, 929, 1153 ….
The largest known Proth prime is
, and is 9,383,761 digits long. It was found by Peter Szabolcs in the
PrimeGrid volunteer computing
Volunteer computing is a type of distributed computing in which people donate their computers' unused resources to a research-oriented project, and sometimes in exchange for credit points. The fundamental idea behind it is that a modern desktop ...
project which announced it on 6 November 2016. It is the 11th-largest known prime number as of January 2024, it was the largest known non-
Mersenne prime
In mathematics, a Mersenne prime is a prime number that is one less than a power of two. That is, it is a prime number of the form for some integer . They are named after Marin Mersenne, a French Minim friar, who studied them in the early 1 ...
until being surpassed in 2023, and is the largest
Colbert number. The second largest known Proth prime is
, found by
PrimeGrid.
Special cases
When ''k=n'', the Proth number takes the form of ''p = n''2
''n'' + 1. If we relax the condition requiring that ''k'' (or ''n'') is odd, these are known as
Cullen numbers, with corresponding
Cullen primes. Though Proths test works when ''n'' is odd, Cullen numbers have their own primality tests for arbitrary ''n''. Cullen's primality tests may be generalized to numbers of the form ''p = n''c
''n'' + 1.
Proof
The proof for this theorem uses the
Pocklington-Lehmer primality test, a corollary to the main theorem of the article. It is a relatively simple special case to prove Proth's theorem from it. It also closely resembles the proof of Pépin's test. The proof can be found on page 52 of the book by Ribenboim in the references.
History
François Proth (1852–1879) published the theorem in 1878.
See also
*
Pépin's test (the special case ''k'' = 1, where one chooses ''a'' = 3)
*
Sierpiński number
References
External links
*
{{number theoretic algorithms
Primality tests
Theorems about prime numbers
de:Prothsche Primzahl
nl:Prothgetal