Prime number generator
In computer science, a prime number generator is an algorithm so that for natural numbers the value is the -th prime number . In mathematics and especially in number theory, this corresponds to formulas that produce a particularly large number of prime numbers (formulas for prime numbers). So far, no efficient prime number generator has been found, in particular there is no practicable closed formula for generating prime numbers.
However, there are formulas where there is a certain probability that a generated number is a prime number, so that the generated numbers still have to be tested to see whether they are prime. The article also deals with other formulas that are not practical, but which have been discussed in the mathematical literature regarding the question of whether they yield many prime numbers.
history
One of the oldest algorithms for determining prime numbers is the sieve of Eratosthenes , in which those numbers are deleted one after the other from a list of natural numbers that are multiples of the smallest number that has not yet been deleted. This leaves the prime numbers in the initial list.
Euler already gave the formulas and that yield prime numbers for and . The two formulas also return many prime numbers for larger values of , because the result can never be divided by prime numbers or whole numbers . In general, there are many such formulas , which explains the eye-catching Ulam spiral . According to Adrien-Marie Legendre , however, there is no polynomial that yields prime numbers for all values of the variables in the natural numbers (not even almost all prime numbers). The question of which integer polynomials produce an infinite number of prime numbers is the subject of the Bunjakowski conjecture .
The most popular is that of the Mersenne number , which is a prime number. The special properties of the divisors of Mersenne numbers make them suitable for searching for the largest possible prime numbers.
Fermat hypothesized that all numbers of the form are prime; they are called Fermat numbers . In fact, no such prime number is known.
An application of Euclid's theorem is also known, in which a 1 is added to the primorial (product of all prime numbers from 2 to ):
is prime for (sequence A005234 in OEIS ) It is unknown whether there are an infinite number of prime numbers that can be generated in this way.
More formulas
- is prime for (sequence A002982 in OEIS )
- is prime for (sequence A002981 in OEIS )
- Prime numbers of the form are: (Sequence A049536 in OEIS )
After the Dirichlet prime number set contains an arithmetic sequence (wherein , prime and are the natural numbers passes) infinitely many primes (but also composite numbers). However, there are Ben Green and Terence Tao for each arithmetic sequences (determined by ) the primes for delivering successive values. For example:
Prime numbers for . The method corresponds to the case of linear polynomials.
Trivial generator
A trivial prime number generator can be inductively defined as follows:
- for is the prime number following on , where simply all numbers in ascending order are tested for whether they are a prime number.
However, this method is quite ineffective, since all odd natural numbers have to be tested one after the other. As an alternative, it is possible to use a sieve method , e.g. B. Sieve of Eratosthenes or Sieve of Atkin , to create a long enough list of prime numbers and then to go through this to the desired prime number. Sometimes one first determines quantities similar to prime numbers (near prime numbers ).
Wilson theorem
A not very practical formula for all prime numbers is based on Wilson's theorem . Using the rounding function, the formula is :
- for natural numbers
According to Wilson's theorem, prime is if and only if . It follows that the formula only delivers prime numbers and every prime number except 2 exactly once. Because is prime, so is and . Is not prime, so is and .
Diophantine sets for prime numbers
After the work on Hilbert's tenth problem, there is a system of finitely many Diophantine equations (polynomials over the whole numbers) that have all prime numbers and only these as a solution. According to Yuri Wladimirowitsch Matijassewitsch , there should be such a system with nine or fewer variables. In 1976 James P. Jones and colleagues gave a system of 14 polynomials in 26 variables. The system explicitly consists of the equations:
with the variables . If and only if there is a solution in natural numbers, the variable is a prime number.
This can also be summarized in an inequality:
If one substitutes natural numbers for the individual variables, then is a prime number if and only if the inequality is fulfilled.
There is also a system of Diophantine equations generating the prime numbers (and only these) with only ten variables, but with a very high degree (of the order of magnitude ). According to Thoralf Skolem, one can always find such a system with only polynomials at most fourth degree, but in this case the number of variables is very high (at least 58, as far as known). The methods have so far been of no practical use.
Mills formula
WH Mills showed in 1947 that there is a real number such that
is prime for all natural numbers . Assuming the Riemann Hypothesis, one can show that the smallest such (the so-called Mill's constant ) has a value of about . The prime numbers generated by the formula hot Mills primes: , , Since about little known (not even know if the constant is rational or irrational) has the formula but no practical value.
Wright's formula
EM Wright found a formula similar to Mills' . Wright showed that there is a real number such that
prim is for everyone .
The following is defined recursively:
- For
Wright also included the first decimal places of . That gives the prime numbers , and . It turns out that with a value of
(the dots mean 4900 decimal places not shown) is a number with 4932 decimal places, but which is even (that is, not a prime number), that is, this value of must be slightly corrected. Far more decimal places are needed for the following prime numbers.
Since the formula is based on knowledge of , it is practically as useless as Mills'.
Conway's prime number generator
For the prime number generating machine (PRIMEGAME) by John Horton Conway see FRACTRAN . However, the method is also impractical for generating lists of prime numbers.
Prime number generator for finite sets of prime numbers
Ross Honsberger gives a simple proof of the following theorem:
Divide the first prime numbers arbitrarily into two disjoint sets , so that . Let be the product of the elements of and that of the elements of . may also be empty , then is ( empty product ). If so , then is prime, and is prime if .
Example: (only numbers smaller than are considered ):
Second example: (only numbers smaller than are considered ):
However are
not less than 169 and therefore not prime.
Web links
- Eric W. Weisstein : Prime Formulas . In: MathWorld (English).
Individual evidence
- ↑ Eric W. Weisstein : Green-Tao Theorem . In: MathWorld (English).
- ↑ James P. Jones, Daihachiro Sato, Hideo Wada, Douglas Wiens: Diophantine representation of the set of prime numbers. American Mathematical Monthly, Vol. 83, 1976, pp. 449-464.
- ↑ James P. Jones: Universal diophantine equation. Journal of Symbolic Logic, Volume 47, 1982, pp. 549-571.
- ↑ Mills: A prime-representing function. Bulletin of the AMS, Volume 53, 1947, p. 604.
- ↑ Follow A051021 in OEIS .
- ^ EM Wright: A prime-representing function. American Mathematical Monthly, Volume 58, 1951, pp. 616-618.
- ^ Robert Baillie: Wright's Fourth Prime [1]
- ^ Richard K. Guy : Conway's Prime Producing Machine. Mathematics Magazine, Volume 56, 1983, pp. 26-33.
- ^ Honsberger: More Mathematical Morsels. Mathematical Association of America 1991, p. 108 (Morsel 20).