HOME

TheInfoList



OR:

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 ...
, a formula for primes is a
formula In science, a formula is a concise way of expressing information symbolically, as in a mathematical formula or a ''chemical formula''. The informal use of the term ''formula'' in science refers to the general construct of a relationship betwe ...
generating the
prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), 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 ...
s, exactly and without exception. Formulas for calculating primes do exist; however, they are computationally very slow. A number of constraints are known, showing what such a "formula" can and cannot be.


Formulas based on Wilson's theorem

A simple formula is :f(n) = \left\lfloor \frac \right\rfloor (n-1) + 2 for positive
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 ...
n, where \lfloor\ \rfloor is the
floor function In mathematics, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least integer greater than or eq ...
, which rounds down to the nearest integer. By
Wilson's theorem In algebra and number theory, Wilson's theorem states that a natural number ''n'' > 1 is a prime number if and only if the product of all the positive integers less than ''n'' is one less than a multiple of ''n''. That is (using the notations of ...
, n+1 is prime if and only if n! \equiv n \!\!\!\pmod. Thus, when n+1 is prime, the first factor in the product becomes one, and the formula produces the prime number n+1. But when n+1 is not prime, the first factor becomes zero and the formula produces the prime number 2. This formula is not an efficient way to generate prime numbers because evaluating n! \bmod (n+1) requires about n-1 multiplications and reductions modulo n+1. In 1964, Willans gave the formula :p_n = 1 + \sum_^ \left\lfloor \left(\frac\right)^ \right\rfloor for the nth prime number p_n. This formula reduces to :p_n = 1 + \sum_^ pi(i) < n that is, it tautologically defines p_n as the smallest integer m for which the prime-counting function \pi(m) is at least n. This formula is also not efficient. In addition to the appearance of (j-1)!, it computes p_n by adding up p_n copies of 1; for example, :p_5 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + \dots + 0 = 11. The articles ''What is an Answer?'' by Herbert Wilf (1982) and ''Formulas for Primes'' by
Underwood Dudley Underwood Dudley (born January 6, 1937) is an American mathematician and writer. His popular works include several books describing crank mathematics by pseudomathematicians who incorrectly believe they have squared the circle or done other im ...
(1983) have further discussion about the worthlessness of such formulas. A shorter formula based on Wilson's theorem was given by J. P. Jones in 1975, using \mathrm as a function: :p_n = \sum_^\left(1 \mathop \left(\left(\sum_^i (j \mathop 1)!^2\textj \right)\right)\right) Here, \mathop is the monus operator, and x\text0 is defined to be x.


Formula based on a system of Diophantine equations

Because the set of primes is a
computably enumerable set In computability theory, a set ''S'' of natural numbers is called computably enumerable (c.e.), recursively enumerable (r.e.), semidecidable, partially decidable, listable, provable or Turing-recognizable if: *There is an algorithm such that the ...
, by Matiyasevich's theorem, it can be obtained from a system of
Diophantine equation ''Diophantine'' means pertaining to the ancient Greek mathematician Diophantus. A number of concepts bear this name: *Diophantine approximation In number theory, the study of Diophantine approximation deals with the approximation of real n ...
s. found an explicit set of 14 Diophantine equations in 26 variables, such that a given number ''k'' + 2 is prime
if and only if In logic and related fields such as mathematics and philosophy, "if and only if" (often shortened as "iff") is paraphrased by the biconditional, a logical connective between statements. The biconditional is true in two cases, where either bo ...
that system has a solution in nonnegative integers: : \alpha_0= wz + h + j - q = 0 : \alpha_1 = (gk + 2g + k + 1)(h + j) + h - z = 0 : \alpha_2= 16(k + 1)^3(k + 2)(n + 1)^2 + 1 - f^2 = 0 : \alpha_3= 2n + p + q + z - e = 0 : \alpha_4= e^3(e + 2)(a + 1)^2 + 1 - o^2 = 0 : \alpha_5=(a^2 - 1)y^2 + 1 - x^2 = 0 : \alpha_6= 16r^2y^4(a^2 - 1) + 1 - u^2 = 0 : \alpha_7= n + \ell + v - y = 0 : \alpha_8= (a^2 - 1)\ell^2 + 1 - m^2 = 0 : \alpha_9= ai + k + 1 - \ell - i = 0 : \alpha_= ((a + u^2(u^2 - a))^2 - 1)(n + 4dy)^2 + 1 - (x + cu)^2 = 0 : \alpha_= p + \ell(a - n - 1) + b(2an + 2a - n^2 - 2n - 2) - m= 0 : \alpha_= q + y(a - p - 1) + s(2ap + 2a - p^2 - 2p - 2) - x = 0 :\alpha_= z + p\ell(a - p) + t(2ap - p^2 - 1) - pm = 0 The 14 equations \alpha_0, \dots, \alpha_ can be used to produce a prime-generating polynomial inequality in 26 variables: : (k+2)(1-\alpha_0^2-\alpha_1^2-\cdots-\alpha_^2) > 0. That is, : \begin & (k+2) (1 - \\ pt& z + h + j - q2 - \\ pt& gk + 2g + k + 1)(h + j) + h - z2 - \\ pt& 6(k + 1)^3(k + 2)(n + 1)^2 + 1 - f^22 - \\ pt& n + p + q + z - e2 - \\ pt& ^3(e + 2)(a + 1)^2 + 1 - o^22 - \\ pt& a^2 - 1)y^2 + 1 - x^22 - \\ pt& 6r^2y^4(a^2 - 1) + 1 - u^22 - \\ pt& + \ell + v - y2 - \\ pt& a^2 - 1)\ell^2 + 1 - m^22 - \\ pt& i + k + 1 - \ell - i2 - \\ pt& (a + u^2(u^2 - a))^2 - 1)(n + 4dy)^2 + 1 - (x + cu)^22 - \\ pt& + \ell(a - n - 1) + b(2an + 2a - n^2 - 2n - 2) - m2 - \\ pt& + y(a - p - 1) + s(2ap + 2a - p^2 - 2p - 2) - x2 - \\ pt& + p\ell(a - p) + t(2ap - p^2 - 1) - pm2) \\ pt& > 0 \end is a polynomial inequality in 26 variables, and the set of prime numbers is identical to the set of positive values taken on by the left-hand side as the variables ''a'', ''b'', …, ''z'' range over the nonnegative integers. A general theorem of Matiyasevich says that if a set is defined by a system of Diophantine equations, it can also be defined by a system of Diophantine equations in only 9 variables. Hence, there is a prime-generating polynomial inequality as above with only 10 variables. However, its degree is large (in the order of 1045). On the other hand, there also exists such a set of equations of degree only 4, but in 58 variables.


Mills' formula

The first such formula known was established by , who proved that there exists a
real number In mathematics, a real number is a number that can be used to measure a continuous one- dimensional quantity such as a duration or temperature. Here, ''continuous'' means that pairs of values can have arbitrarily small differences. Every re ...
''A'' such that, if :d_n = A^ then :\left \lfloor d_n \right \rfloor = \left \lfloor A^ \right \rfloor is a prime number for all positive integers n. If the
Riemann hypothesis In mathematics, the Riemann hypothesis is the conjecture that the Riemann zeta function has its zeros only at the negative even integers and complex numbers with real part . Many consider it to be the most important unsolved problem in pure ...
is true, then the smallest such A has a value of around 1.3063778838630806904686144926... and is known as Mills' constant. This value gives rise to the primes \left \lfloor d_1 \right \rfloor = 2, \left \lfloor d_2 \right \rfloor = 11, \left \lfloor d_3 \right \rfloor = 1361, ... . Very little is known about the constant A (not even whether it is
rational Rationality is the quality of being guided by or based on reason. In this regard, a person acts rationally if they have a good reason for what they do, or a belief is rational if it is based on strong evidence. This quality can apply to an ...
). This formula has no practical value, because there is no known way of calculating the constant without finding primes in the first place. There is nothing special about the
floor function In mathematics, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least integer greater than or eq ...
in the formula. Tóth proved that there also exists a constant B such that : \lceil B^ \rceil is also prime-representing for r>2.106\ldots. In the case r=3, the value of the constant B begins with 1.24055470525201424067... The first few primes generated are: :2, 7, 337, 38272739, 56062005704198360319209, : 176199995814327287356671209104585864397055039072110696028654438846269, \ldots ''Without'' assuming the Riemann hypothesis, Elsholtz developed several prime-representing functions similar to those of Mills. For example, if A = 1.00536773279814724017 \ldots, then \left\lfloor A^ \right\rfloor is prime for all positive integers n. Similarly, if A = 3.8249998073439146171615551375 \ldots, then \left\lfloor A^ \right\rfloor is prime for all positive integers n.


Wright's formula

A
tetration In mathematics, tetration (or hyper-4) is an operation (mathematics), operation based on iterated, or repeated, exponentiation. There is no standard mathematical notation, notation for tetration, though Knuth's up arrow notation \uparrow \upa ...
ally growing prime-generating formula similar to Mills' comes from a theorem of E. M. Wright. He proved that there exists a real number ''α'' such that, if :g_0 = \alpha and :g_ = 2^ for n \ge 0, then :\left \lfloor g_n \right \rfloor = \left \lfloor 2^ \right \rfloor is prime for all n \ge 1. Wright gives the first seven decimal places of such a constant: \alpha = 1.9287800. This value gives rise to the primes \left \lfloor g_1 \right \rfloor = \left \lfloor 2^ \right \rfloor = 3 , \left \lfloor g_2 \right \rfloor = 13 , and \left \lfloor g_3 \right \rfloor = 16381 . \left \lfloor g_4 \right \rfloor is even, and so is not prime. However, with \alpha = 1.9287800 + 8.2843 \cdot 10^, \left \lfloor g_1 \right \rfloor, \left \lfloor g_2 \right \rfloor, and \left \lfloor g_3 \right \rfloor are unchanged, while \left \lfloor g_4 \right \rfloor is a prime with 4932 digits. This
sequence In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order matters. Like a set, it contains members (also called ''elements'', or ''terms''). The number of elements (possibly infinite) is cal ...
of primes cannot be extended beyond \left \lfloor g_4 \right \rfloor without knowing more digits of \alpha. Like Mills' formula, and for the same reasons, Wright's formula cannot be used to find primes.


A function that represents all primes

Given the constant f_1 = 2.920050977316\ldots , for n \ge 2, define the sequence where \left\lfloor\ \right\rfloor is the
floor function In mathematics, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least integer greater than or eq ...
. Then for n \ge 1, \left\lfloor f_ \right\rfloor equals the nth prime: \left\lfloor f_1 \right\rfloor = 2, \left\lfloor f_2 \right\rfloor = 3, \left\lfloor f_3 \right\rfloor = 5, etc. The initial constant f_1 = 2.920050977316 given in the article is precise enough for equation () to generate the primes through 37, the 12th prime. The ''exact'' value of f_1 that generates ''all'' primes is given by the rapidly-converging series : f_1 = \sum_^\infty \frac = \frac + \frac + \frac + \frac + \cdots, where p_n is the nth prime, and P_n is the product of all primes less than p_n. The more digits of f_1 that we know, the more primes equation () will generate. For example, we can use 25 terms in the series, using the 25 primes less than 100, to calculate the following more precise approximation: : f_1 \simeq 2.920050977316134712092562917112019. This has enough digits for equation () to yield again the 25 primes less than 100. As with Mills' formula and Wright's formula above, in order to generate a longer list of primes, we need to start by knowing more digits of the initial constant, f_1, which in this case requires a longer list of primes in its calculation.


Plouffe's formulas

In 2018 Simon Plouffe
conjecture In mathematics, a conjecture is a conclusion or a proposition that is proffered on a tentative basis without proof. Some conjectures, such as the Riemann hypothesis or Fermat's conjecture (now a theorem, proven in 1995 by Andrew Wiles), ha ...
d a set of formulas for primes. Similarly to the formula of Mills, they are of the form :\left\ where \ is the function rounding to the nearest integer. For example, with a_0\approx 43.80468771580293481 and r=5/4, this gives 113, 367, 1607, 10177, 102217... . Using a_0=10^+961+\varepsilon and r=1.01 with \varepsilon a certain number between 0 and one half, Plouffe found that he could generate a sequence of 50 probable primes (with high probability of being prime). Presumably there exists an ε such that this formula will give an infinite sequence of actual prime numbers. The number of digits starts at 501 and increases by about 1% each time.


Prime formulas and polynomial functions

It is known that no non-
constant polynomial In mathematics, a polynomial is a Expression (mathematics), mathematical expression consisting of indeterminate (variable), indeterminates (also called variable (mathematics), variables) and coefficients, that involves only the operations of addit ...
function ''P''(''n'') with integer coefficients exists that evaluates to a prime number for all integers ''n''. The proof is as follows: suppose that such a polynomial existed. Then ''P''(1) would evaluate to a prime ''p'', so P(1) \equiv 0 \pmod p. But for any integer ''k'', P(1+kp) \equiv 0 \pmod p also, so P(1+kp) cannot also be prime (as it would be divisible by ''p'') unless it were ''p'' itself. But the only way P(1+kp) = P(1) = p for all ''k'' is if the polynomial function is constant. The same reasoning shows an even stronger result: no non-constant polynomial function ''P''(''n'') exists that evaluates to a prime number for
almost all In mathematics, the term "almost all" means "all but a negligible quantity". More precisely, if X is a set (mathematics), set, "almost all elements of X" means "all elements of X but those in a negligible set, negligible subset of X". The meaning o ...
integers ''n''. Euler first noticed (in 1772) that the quadratic polynomial :P(n) = n^2 + n + 41 is prime for the 40 integers ''n'' = 0, 1, 2, ..., 39, with corresponding primes 41, 43, 47, 53, 61, 71, ..., 1601. The differences between the terms are 2, 4, 6, 8, 10... For ''n'' = 40, it produces a
square number In mathematics, a square number or perfect square is an integer that is the square (algebra), square of an integer; in other words, it is the multiplication, product of some integer with itself. For example, 9 is a square number, since it equals ...
, 1681, which is equal to 41 × 41, the smallest
composite number A composite number is a positive integer that can be formed by multiplying two smaller positive integers. Accordingly it is a positive integer that has at least one divisor other than 1 and itself. Every positive integer is composite, prime numb ...
for this formula for ''n'' ≥ 0. If 41 divides ''n'', it divides ''P''(''n'') too. Furthermore, since ''P''(''n'') can be written as ''n''(''n'' + 1) + 41, if 41 divides ''n'' + 1 instead, it also divides ''P''(''n''). The phenomenon is related to the Ulam spiral, which is also implicitly quadratic, and the class number; this polynomial is related to the
Heegner number 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 int ...
163=4\cdot 41-1. There are analogous polynomials for p=2, 3, 5, 11 \text 17 (the lucky numbers of Euler), corresponding to other Heegner numbers. Given a positive integer ''S'', there may be infinitely many ''c'' such that the expression ''n''2 + ''n'' + ''c'' is always coprime to ''S''. The integer ''c'' may be negative, in which case there is a delay before primes are produced. It is known, based on Dirichlet's theorem on arithmetic progressions, that linear polynomial functions L(n) = an + b produce infinitely many primes as long as ''a'' and ''b'' are
relatively prime In number theory, 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 equiv ...
(though no such function will assume prime values for all values of ''n''). Moreover, the Green–Tao theorem says that for any ''k'' there exists a pair of ''a'' and ''b'', with the property that L(n) = an+b is prime for any ''n'' from 0 through ''k'' − 1. However, the best known result of such type is for ''k'' = 27: :224584605939537911 + 18135696597948930n is prime for all ''n'' from 0 through 26. It is not even known whether there exists a
univariate polynomial In mathematics, a polynomial is a mathematical expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication and exponentiation to nonnegative integer ...
of degree at least 2, that assumes an infinite number of values that are prime; see Bunyakovsky conjecture.


Possible formula using a recurrence relation

Another prime generator is defined by the
recurrence relation In mathematics, a recurrence relation is an equation according to which the nth term of a sequence of numbers is equal to some combination of the previous terms. Often, only k previous terms of the sequence appear in the equation, for a parameter ...
: a_n = a_ + \gcd(n,a_), \quad a_1 = 7, where gcd(''x'', ''y'') denotes 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 ...
of ''x'' and ''y''. The sequence of differences ''a''''n''+1 − ''an'' starts with 1, 1, 1, 5, 3, 1, 1, 1, 1, 11, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 23, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 3, 1, 5, 3, ... . proved that this sequence contains only ones and prime numbers. However, it does not contain all the prime numbers, since the terms gcd(''n'' + 1, ''an'') are always odd and so never equal to 2. The same paper conjectures that the sequence contains all odd primes: in fact, 587 is the smallest odd prime not appearing in the first 10,000 outcomes different from 1.. This recurrence is rather inefficient. In perspective, it is trivial to write an algorithm to generate all prime numbers (from the definition), and many more efficient algorithms are known. Thus, such recurrence relations are more a matter of curiosity than of practical use.


See also

*
Prime number theorem In mathematics, the prime number theorem (PNT) describes the asymptotic analysis, asymptotic distribution of the prime numbers among the positive integers. It formalizes the intuitive idea that primes become less common as they become larger by p ...


References


Further reading

*. *A Venugopalan. ''Formula for primes, twinprimes, number of primes and number of twinprimes''. Proceedings of the Indian Academy of Sciences—Mathematical Sciences, Vol. 92, No 1, September 1983
pp. 49–52errata


External links

* {{Prime number classes Prime numbers