This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A001097 #156 Mar 12 2025 07:38:07 %S A001097 3,5,7,11,13,17,19,29,31,41,43,59,61,71,73,101,103,107,109,137,139, %T A001097 149,151,179,181,191,193,197,199,227,229,239,241,269,271,281,283,311, %U A001097 313,347,349,419,421,431,433,461,463,521,523,569,571,599,601,617,619,641,643 %N A001097 Twin primes. %C A001097 Union of A001359 and A006512. %C A001097 The only twin primes that are Fibonacci numbers are 3, 5 and 13 [MacKinnon]. - _Emeric Deutsch_, Apr 24 2005 %C A001097 (p, p+2) are twin primes if and only if p + 2 can be represented as the sum of two primes. Brun (1919): Even if there are infinitely many twin primes, the series of all twin prime reciprocals does converges to [Brun's constant] (A065421). Clement (1949): For every n > 1, (n, n+2) are twin primes if and only if 4((n-1)! + 1) == -n (mod n(n+2)). - _Stefan Steinerberger_, Dec 04 2005 %C A001097 A164292(a(n)) = 1. - _Reinhard Zumkeller_, Mar 29 2010 %C A001097 The 100355-digit numbers 65516468355 * 2^333333 +- 1 are currently the largest known twin prime pair. They were discovered by Twin Prime Search and Primegrid in August 2009. - _Paul Muljadi_, Mar 07 2011 %C A001097 For every n > 2, the pair (n, n+2) is a twin prime if and only if ((n-1)!!)^4 == 1 (mod n*(n+2)). - _Thomas Ordowski_, Aug 15 2016 %C A001097 The term "twin primes" ("primzahlzwillinge", in German) was coined by the German mathematician Paul Gustav Samuel Stäckel (1862-1919) in 1916. Brun (1919) used the same term in French ("nombres premiers jumeaux"). Glaisher (1878) and Hardy and Littlewood (1923) used the term "prime-pairs". The term "twin primes" in English was used by Dantzig (1930). - _Amiram Eldar_, May 20 2023 %D A001097 Tobias Dantzig, Number: The Language of Science, Macmillan, 1930. %D A001097 Paulo Ribenboim, The New Book of Prime Number Records, Springer-Verlag, 1996, pp. 259-265. %D A001097 David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See p. 132. %H A001097 T. D. Noe, <a href="/A001097/b001097.txt">Table of n, a(n) for n = 1..10000</a> %H A001097 M. Abramowitz and I. A. Stegun, eds., <a href="http://www.convertit.com/Go/ConvertIt/Reference/AMS55.ASP">Handbook of Mathematical Functions</a>, National Bureau of Standards, Applied Math. Series 55, Tenth Printing, 1972, p. 870. %H A001097 Viggo Brun, La série 1/5 + 1/7 + 1/11 + 1/13 + 1/17 + 1/19 + 1/29 + 1/31 + 1/41 + 1/43 + 1/59 + 1/61 + ... où les dénominateurs sont "nombres premiers jumeaux" est convergente ou finie, Bull Sci. Math. 43 (1919), <a href="https://gallica.bnf.fr/ark:/12148/bpt6k96292009/f104.image">100-104</a> and <a href="https://gallica.bnf.fr/ark:/12148/bpt6k96292009/f128.image">124-128</a>. %H A001097 J. P. Delahaye, <a href="http://web.archive.org/web/20130718051125/http://www.lifl.fr/~delahaye/SIME/JPD/PLS_Nb_premiers_jumeaux.pdf">Premiers jumeaux: frères ennemis?</a> [Twin primes: Enemy Brothers?], Pour la science, No. 260 (Juin 1999), 102-106. %H A001097 Harvey Dubner, <a href="http://www.emis.de/journals/JIS/VOL8/Dubner/dubner71.html">Twin Prime Statistics</a>, Journal of Integer Sequences, Vol. 8 (2005), Article 05.4.2. %H A001097 J. C. Evard, <a href="http://web.archive.org/web/20110726012847/http://www.math.utoledo.edu/~jevard/Page012.htm">Twin primes and their applications</a>. [Cached copy on the Wayback Machine] %H A001097 J. C. Evard, <a href="/A077800/a077800.html">Twin primes and their applications</a>. [Local cached copy] %H A001097 J. C. Evard, <a href="/A077800/a077800.pdf">Twin primes and their applications</a>. [Pdf file of cached copy] %H A001097 J. W. L. Glaisher, <a href="https://archive.org/details/messengermathem04glaigoog/page/n38/mode/2up">An enumeration of prime-pairs</a>, Messenger of Mathematics, Vol. 8 (1878), pp. 28-33. %H A001097 Andrew Granville, <a href="http://www.dms.umontreal.ca/~andrew/PDF/BaltimoreLecture.pdf">Primes in intervals of bounded length</a>, Joint Math Meeting, Current Events Bulletin, Baltimore, Friday, Jan 17 2014. %H A001097 G. H. Hardy and J. E. Littlewood, <a href="https://doi.org/10.1007/BF02403921">Some problems of 'Partitio numerorum'; III: On the expression of a number as a sum of primes</a>, Acta Mathematica, Vol. 44, No. 1 (1923), pp. 1-70; <a href="http://archive.ymsc.tsinghua.edu.cn/pacm_download/117/5327-11511_2006_Article_BF02403921.pdf">alternative link</a>. %H A001097 Nick MacKinnon, <a href="http://www.jstor.org/stable/2695779">Problem 10844</a>, Amer. Math. Monthly 109, (2002), p. 78. %H A001097 James Maynard, <a href="https://www.jstor.org/stable/24522956">Small gaps between primes</a>, Annals of Mathematics, Second series, Vol. 181, No. 1 (2015), pp. 383-413; <a href="http://arxiv.org/abs/1311.4600">arXiv preprint</a>, arXiv:1311.4600 [math.NT], 2013-2019. %H A001097 Omar E. Pol, <a href="http://www.polprimos.com">Determinacion geometrica de los numeros primos y perfectos</a>. %H A001097 D. H. J. Polymath, <a href="http://arxiv.org/abs/1402.0811">New equidistribution estimates of Zhang type, and bounded gaps between primes</a>, arXiv:1402.0811 [math.NT], 2014. %H A001097 D. H. J. Polymath, <a href="http://arxiv.org/abs/1407.4897">Variants of the Selberg sieve, and bounded intervals containing many primes</a>, arXiv:1407.4897 [math.NT], 2014. %H A001097 Paul Stäckel, <a href="https://archiv.ub.uni-heidelberg.de/volltextserver/12465/">Die Darstellung der geraden Zahlen als Summen von zwei Primzahlen</a>, Sitzungsberichte der Heidelberger Akademie der Wissenschaften, Mathematisch-naturwissenschaftliche Klasse (in German), Abt. A, Bd. 10 (1916), pp. 1-47. See p. 22. %H A001097 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/TwinPrimes.html">Twin Primes</a>. %H A001097 Yitang Zhang, <a href="http://dx.doi.org/10.4007/annals.2014.179.3.7">Bounded gaps between primes</a>, Annals of Mathematics, Volume 179, Issue 3 (2014), Pages 1121-1174. %H A001097 <a href="/index/Cor#core">Index entries for "core" sequences</a>. %H A001097 <a href="/index/Pri#gaps">Index entries for primes, gaps between</a>. %p A001097 A001097 := proc(n) %p A001097 option remember; %p A001097 if n = 1 then %p A001097 3; %p A001097 else %p A001097 for a from procname(n-1)+1 do %p A001097 if isprime(a) and ( isprime(a-2) or isprime(a+2) ) then %p A001097 return a; %p A001097 end if; %p A001097 end do: %p A001097 end if; %p A001097 end proc: # _R. J. Mathar_, Feb 19 2015 %t A001097 Select[ Prime[ Range[120]], PrimeQ[ # - 2] || PrimeQ[ # + 2] &] (* _Robert G. Wilson v_, Jun 09 2005 *) %t A001097 Union[Flatten[Select[Partition[Prime[Range[200]],2,1],#[[2]]-#[[1]] == 2&]]] (* _Harvey P. Dale_, Aug 19 2015 *) %o A001097 (PARI) isA001097(n) = (isprime(n) && (isprime(n+2) || isprime(n-2))) \\ _Michael B. Porter_, Oct 29 2009 %o A001097 (PARI) a(n)=if(n==1,return(3));my(p);forprime(q=3,default(primelimit), if(q-p==2 && (n-=2)<0, return(if(n==-1,q,p)));p=q) \\ _Charles R Greathouse IV_, Aug 22 2012 %o A001097 (PARI) list(lim)=my(v=List([3]),p=5); forprime(q=7,lim, if(q-p==2, listput(v,p); listput(v,q)); p=q); if(p+2>lim && isprime(p+2), listput(v,p)); Vec(v) \\ _Charles R Greathouse IV_, Mar 17 2017 %o A001097 (Haskell) %o A001097 a001097 n = a001097_list !! (n-1) %o A001097 a001097_list = filter ((== 1) . a164292) [1..] %o A001097 -- _Reinhard Zumkeller_, Feb 03 2014, Nov 27 2011 %o A001097 (Python) %o A001097 from sympy import nextprime %o A001097 from itertools import islice %o A001097 def agen(): # generator of terms %o A001097 yield 3 %o A001097 p, q = 5, 7 %o A001097 while True: %o A001097 if q - p == 2: yield from [p, q] %o A001097 p, q = q, nextprime(q) %o A001097 print(list(islice(agen(), 58))) # _Michael S. Branicky_, Apr 30 2022 %Y A001097 Cf. A070076, A001359, A006512, A164292. See A077800 for another version. %K A001097 nonn,core,nice %O A001097 1,1 %A A001097 _N. J. A. Sloane_, Mar 15 1996