Twin Primes

DOWNLOAD Mathematica Notebook Contribute to this entry

Twin primes are pairs of primes of the form (p, p+2). The term "twin prime" was coined by Paul Stäckel (1862-1919; Tietze 1965, p. 19). The first few twin primes are n+/-1 for n=4, 6, 12, 18, 30, 42, 60, 72, 102, 108, 138, 150, 180, 192, 198, 228, 240, 270, 282, ... (OEIS A014574). Explicitly, these are (3, 5), (5, 7), (11, 13), (17, 19), (29, 31), (41, 43), ... (OEIS A001359 and A006512).

All twin primes except (3, 5) are of the form 6n+/-1.

It is conjectured that there are an infinite number of twin primes (this is one form of the twin prime conjecture), but proving this remains one of the most elusive open problems in number theory. An important result for twin primes is Brun's theorem, which states that the number obtained by adding the reciprocals of the odd twin primes,

 B=(1/3+1/5)+(1/5+1/7)+(1/(11)+1/(13))+(1/(17)+1/(19))+...,
(1)

converges to a definite number ("Brun's constant"), which expresses the scarcity of twin primes, even if there are infinitely many of them (Ribenboim 1996, p. 201). By contrast, the series of all prime reciprocals diverges to infinity, as follows from the Mertens second theorem by letting x->infty.

The following table gives the first few p for the twin primes (p, p+2), cousin primes (p, p+4), sexy primes (p, p+6), etc.

pairSloanefirst member
(p, p+2)A0013593, 5, 11, 17, 29, 41, 59, 71, ...
(p, p+4)A0232003, 7, 13, 19, 37, 43, 67, 79, ...
(p, p+6)A0232015, 7, 11, 13, 17, 23, 31, 37, ...
(p, p+8)A0232023, 5, 11, 23, 29, 53, 59, 71, ...
(p, p+10)A0232033, 7, 13, 19, 31, 37, 43, 61, ...
(p, p+12)A0461335, 7, 11, 17, 19, 29, 31, 41, ...

Let pi_2(n) be the number of twin primes p and p+2 such that p<=n. It is not known if there are an infinite number of such primes (Wells 1986, p. 41; Shanks 1993), but it seems almost certain to be true (Hardy and Wright 1979, p. 5).

J. R. Chen has shown there exists an infinite number of primes p such that p+2 has at most two factors (Le Lionnais 1979, p. 49). Brun proved that there exists a computable integer x_0 such that if x>=x_0, then

 pi_2(x)<(100x)/((lnx)^2)
(2)

(Ribenboim 1996, p. 261). It has been shown that

 pi_2(x)<=cproduct_(p>2)[1-1/((p-1)^2)]x/((lnx)^2)[1+O((lnlnx)/(lnx))],
(3)

written more concisely as

 pi_2(x)<=cPi_2x/((lnx)^2)[1+O((lnlnx)/(lnx))],
(4)

where Pi_2 is known as the twin primes constant and c is another constant. The constant c has been reduced to 68/9 approx 7.5556 (Fouvry and Iwaniec 1983), 128/17 approx 7.5294 (Fouvry 1984), 7 (Bombieri et al. 1986), 6.9075 (Fouvry and Grupp 1986), 6.8354 (Wu 1990), and 6.8325 (Haugland 1999). The latter calculation involved evaluation of 7-fold integrals and fitting of three different parameters.

Hardy and Littlewood (1923) conjectured that c=2 (Ribenboim 1996, p. 262), and that pi_2(x) is asymptotically equal to

 pi_2(x)∼2Pi_2int_2^x(dx)/((lnx)^2).
(5)

This result is sometimes called the strong twin prime conjecture and is a special case of the k-tuple conjecture. A necessary (but not sufficient) condition for the twin prime conjecture to hold is that the prime gaps constant, defined by

 Delta=limsup_(n->infty)(p_(n+1)-p_n)/(p_n),
(6)

where p_n is the nth prime and d_n=p_(n+1)-p_n is the prime difference function, satisfies Delta=0.

Wolf notes that the formula

 pi_2(x)∼2Pi_2([pi(x)]^2)/x,
(7)

(which has asymptotic growth ∼Pi_2x/(lnx)^2) agrees with numerical data much better than does Pi_2x/(lnx)^2, although not as well as Pi_2Li_2(x).

Extending the search done by Brent in 1974 or 1975, Wolf has searched for the analog of the Skewes number for twins, i.e., an x such that pi_2(x)-Pi_2Li_2(x) changes sign. Wolf checked numbers up to 2^(42) and found more than 90000 sign changes. From this data, Wolf conjectured that the number of sign changes nu(n) for x<n of pi_2(x)-Pi_2Li_2(x) is given by

 nu(n)∼(sqrt(n))/(lnn).
(8)

Proof of this conjecture would also imply the existence an infinite number of twin primes.

The largest known twin primes as of Dec. 2015 correspond to

 3756801695685·2^(666669)+/-1,
(9)

each having 200700 decimal digits and found by PrimeGrid on Dec. 25, 2011 (PrimeGrid; http://primes.utm.edu/top20/page.php?id=1#records).

In 1995, Nicely discovered a flaw in the Intel® PentiumTM microprocessor by computing the reciprocals of 824633702441 and 824633702443, which should have been accurate to 19 decimal places but were incorrect from the tenth decimal place on (Cipra 1995, 1996; Nicely 1996).

If n>=2, the integers n and n+2 form a pair of twin primes iff

 4[(n-1)!+1]+n=0 (mod n(n+2)).
(10)

n=pp^' where (p,p^') is a pair of twin primes iff

 phi(n)sigma(n)=(n-3)(n+1)
(11)

(Ribenboim 1996, p. 259). S. M. Ruiz has found the unexpected result that (n,n+2) are twin primes iff

 sum_(i=1)^ni^a(|_(n+2)/i_|+|_n/i_|)=2+n^a+sum_(i=1)^ni^a(|_(n+1)/i_|+|_(n-1)/i_|)
(12)

for a>=0, where |_x_| is the floor function.

The values of pi_2(n) were found by Brent (1976) up to n=10^(11). T. Nicely calculated them up to 10^(14) in his calculation of Brun's constant. Fry et al. (2001) and Sebah (2002) independently obtained pi_2(10^(16)) using distributed computation. The following table gives known values of pi_2(10^n) (OEIS A007508; Ribenboim 1996, p. 263; Nicely 1999; Sebah 2002).

npi_2(n)
10^335
10^4205
10^51224
10^68169
10^758980
10^8440312
10^93424506
10^(10)27412679
10^(11)224376048
10^(12)1870585220
10^(13)15834664872
10^(14)135780321665
10^(15)1177209242304
10^(16)10304195697298

It is conjectured that every even number is a sum of a pair of twin primes except a finite number of exceptions whose first few terms are 2, 4, 94, 96, 98, 400, 402, 404, 514, 516, 518, ... (OEIS A007534; Wells 1986, p. 132).

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.