TOPICS
Search

Twin Primes


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 series of reciprocals of the odd twin primes,

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

is a convergent series whose sum is 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 number reciprocals is a divergent series tending to infinity, as follows from the Mertens second theorem by letting x->infty.

The proved theorem on bounded gaps between primes gives infinitely many pairs of consecutive primes separated by at most 246 (Polymath 2014). It does not prove that infinitely many pairs are separated by exactly 2, so the twin prime conjecture remains open.

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.

pairOEISfirst 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 infinitely many such primes (Wells 1986, p. 41; Shanks 1993), but it seems almost certain to be true (Hardy and Wright 1979, p. 5).

Chen's theorem shows that there are infinitely many primes p such that p+2 is either a prime or a semiprime (Chen 1973). 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) satisfies the asymptotic relation

 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. The prime number theorem already implies that

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

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

Using the prime number theorem, the strong twin prime conjecture is equivalently expressed as

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

where pi(x) is the prime counting function.

Wolf (2008) studied the analog of the Skewes number for twin primes, comparing his twin-prime count with

 2Pi_2int_2^x(du)/((lnu)^2).
(8)

With this lower integration limit and normalization, he reported 90,355 sign changes through 2^(42) (Wolf 2008, Table 1). This is an attributed result of computation using his counting convention. Wolf (2008) proposed

 nu(T) approx (sqrt(T))/(lnT),
(9)

where nu(T) counts these sign changes through T. This growth approximation is conjectural. If the number of sign changes were unbounded, there would be infinitely many twin primes.

The largest known twin-prime pair as of Aug. 2026 is

 2996863034895·2^(1290000)+/-1,
(10)

whose members each have 388,342 decimal digits. Tom Greer found the pair as part of PrimeGrid in Sep. 2016 (PrimeGrid 2016, PrimePages 2026).

In 1995, Nicely discovered a flaw in the Intel® Pentium™ 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, Nicely 1995, Cipra 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)).
(11)

A positive integer n is the product pp^' of a pair of twin primes (p,p^') iff

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

where phi(n) is the totient function and sigma(n) is the divisor function (Ribenboim 1996, p. 259). For a positive integer n, S. M. Ruiz's criterion (Ruiz and Ariff 2004, pp. 357, 359) states 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_|)
(13)

for a real number 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. Later computations extended the values through 10^(19). 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
10^(17)90948839353159
10^(18)808675888577436
10^(19)7237518093734545

It is conjectured that every sufficiently large positive even number is a sum of two primes that each belong to a twin-prime pair, with equal summands allowed. The first few exceptions are 2, 4, 94, 96, 98, 400, 402, 404, 514, 516, 518, ... (OEIS A007534; Wells 1986, p. 132).


See also

Bitwin Chain, Bounded Gaps Between Primes, Brun's Constant, Chen's Theorem, Cousin Primes, de Polignac's Conjecture, Prime Arithmetic Progression, Prime Constellation, Prime Gaps, Sexy Primes, Twin Composites, Twin Prime Cluster, Twin Prime Conjecture, Twin Primes Constant

Explore with Wolfram|Alpha

References

Bombieri, E.; Friedlander, J. B.; and Iwaniec, H. "Primes in Arithmetic Progression to Large Moduli." Acta Math. 156, 203-251, 1986.Bradley, C. J. "The Location of Twin Primes." Math. Gaz. 67, 292-294, 1983.Brent, R. P. "Irregularities in the Distribution of Primes and Twin Primes." Math. Comput. 29, 43-56, 1975.Brent, R. P. "UMT 4." Math. Comput. 29, 221, 1975.Brent, R. P. "Tables Concerning Irregularities in the Distribution of Primes and Twin Primes to 10^(11)." Math. Comput. 30, 379, 1976.Chen, J. R. "On the Representation of a Large Even Integer as the Sum of a Prime and the Product of at Most Two Primes. I." Sci. Sinica 16, 157-176, 1973.Cipra, B. "How Number Theory Got the Best of the Pentium Chip." Science 267, 175, 1995.Cipra, B. "Divide and Conquer." What's Happening in the Mathematical Sciences, 1995-1996, Vol. 3. Providence, RI: Amer. Math. Soc., pp. 38-47, 1996.Fouvry, É. "Autour du théorème de Bombieri-Vinogradov." Acta Math. 152, 219-244, 1984.Fouvry, É. and Grupp, F. "On the Switching Principle in Sieve Theory." J. reine angew. Math. 370, 101-126, 1986.Fouvry, É. and Iwaniec, H. "Primes in Arithmetic Progressions." Acta Arith. 42, 197-218, 1983.Fry, P.; Nesheiwat, J.; and Szymanski, B. K. "Experiences with Distributed Computation of Twin Primes Distribution." In Progress in Computer Research, Vol. 2. (Ed. F. Columbus). Commack, NY: Nova Science Pub., pp. 187-203, 2001.Gardner, M. "Patterns in Primes Are a Clue to the Strong Law of Small Numbers." Sci. Amer. 243, 18-28, Dec. 1980.Gourdon, X. and Sebah, P. "Introduction to Twin Primes and Brun's Constant Computation." http://numbers.computation.free.fr/Constants/Primes/twin.html.Guy, R. K. "Gaps Between Primes. Twin Primes." §A8 in Unsolved Problems in Number Theory, 2nd ed. New York: Springer-Verlag, pp. 19-23, 1994.Hardy, G. H. and Wright, E. M. An Introduction to the Theory of Numbers, 5th ed. Oxford, England: Clarendon Press, 1979.Haugland, J. K. "Application of Sieve Methods to Prime Numbers." PhD thesis. Oxford, England: Oxford University, 1999.Indlekofer, K. H. and Járai, A. "Largest Known Twin Primes." Math. Comput. 65, 427-428, 1996.Indlekofer, K. H. and Járai, A. "Largest Known Twin Primes and Sophie Germain Primes." Math. Comput. 68, 1317-1324, 1999.Nicely, T. R. "Enumeration to 10^(14) of the Twin Primes and Brun's Constant." Virginia J. Sci. 46, 195-204, 1995. https://oeis.org/A001359/a001359.pdf.Nicely, T. R. "New Maximal Prime Gaps and First Occurrences." Math. Comput. 68, 1311-1315, 1999.Update a linkNicely, T. R. "The Pentium Bug." https://faculty.lynchburg.edu/~nicely/pentbug/pentbug.htmlNumberphile. Featuring J. Grime. "Goldbach Conjecture (but with Twin Primes)." Sep. 14, 2024. https://www.youtube.com/watch?v=Gojd8mTl3Do.Nyman, B. and Nicely, T. R. "New Prime Gaps Between 10^(15) and 5×10^(16)." J. Int. Seq. 6, 1-6, 2003.Parady, B. K.; Smith, J. F.; and Zarantonello, S. E. "Largest Known Twin Primes." Math. Comput. 55, 381-382, 1990.Polymath, D. H. J. "Variants of the Selberg Sieve, and Bounded Intervals Containing Many Primes." Res. Math. Sci. 1, Article 12, 2014. https://doi.org/10.1186/s40687-014-0012-7.PrimeGrid. "PrimeGrid's Sophie Germain Prime Search." Sep. 14, 2016. https://www.primegrid.com/download/twin-1290000.pdf.PrimePages. "The Top Twenty: Twin Primes." 2026. https://t5k.org/top20/page.php?id=1&lang=en.Ribenboim, P. "Twin Primes." §4.3 in The New Book of Prime Number Records. New York: Springer-Verlag, pp. 259-265, 1996.Ruiz, S. M. and Ariff, A. "A Basic Characteristic of Twin Primes and Its Generalization." Smarandache Notions Journal 14, 357-362, 2004. https://fs.unm.edu/SNJ/ABasicCharacteristicOfTwinPrimes.pdf.Sebah, P. "Counting Twin Primes and Brun's Constant New Computation." 22 Aug 2002. https://listserv.nodak.edu/cgi-bin/wa.exe?A2=ind0208&L=nmbrthry&P=1968.Shanks, D. Solved and Unsolved Problems in Number Theory, 4th ed. New York: Chelsea, p. 30, 1993.Sloane, N. J. A. Sequences A001359/M2476, A006512/M3763, A007508/M1855, A007534, A014574, A023200, A023201, A023202, A023203, and A046133 in "The On-Line Encyclopedia of Integer Sequences."Tietze, H. "Prime Numbers and Prime Twins." Ch. 1 in Famous Problems of Mathematics: Solved and Unsolved Mathematics Problems from Antiquity to Modern Times. New York: Graylock Press, pp. 1-20, 1965.Veritasium. "We're 99.9% Sure This Pattern Is True, but No One Can Prove It." Jun. 14, 2026. https://www.youtube.com/watch?v=8HBDE-msUjw.Weintraub, S. "A Prime Gap of 864." J. Recr. Math. 25, 42-43, 1993.Wells, D. The Penguin Dictionary of Curious and Interesting Numbers. Middlesex, England: Penguin Books, p. 41, 1986.Wolf, M. "An Analog of the Skewes Number for Twin Primes." 15 Jan 2008. https://arxiv.org/abs/0707.0980v2.Wolf, M. "On Twin and Cousin Primes." https://mwolf.pracownicy.uksw.edu.pl/twins_cousins.pdf.Wolf, M. "Some Conjectures on the Gaps between Consecutive Primes." https://mwolf.pracownicy.uksw.edu.pl/conjectures.pdf.Wu, J. "Sur la suite des nombres premiers jumeaux." Acta. Arith. 55, 365-394, 1990.

Referenced on Wolfram|Alpha

Twin Primes

Cite this as:

Weisstein, Eric W. "Twin Primes." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/TwinPrimes.html

Subject classifications