cp's OEIS Frontend

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.

A001097 Twin primes.

Original entry on oeis.org

3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43, 59, 61, 71, 73, 101, 103, 107, 109, 137, 139, 149, 151, 179, 181, 191, 193, 197, 199, 227, 229, 239, 241, 269, 271, 281, 283, 311, 313, 347, 349, 419, 421, 431, 433, 461, 463, 521, 523, 569, 571, 599, 601, 617, 619, 641, 643
Offset: 1

Views

Author

N. J. A. Sloane, Mar 15 1996

Keywords

Comments

Union of A001359 and A006512.
The only twin primes that are Fibonacci numbers are 3, 5 and 13 [MacKinnon]. - Emeric Deutsch, Apr 24 2005
(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
A164292(a(n)) = 1. - Reinhard Zumkeller, Mar 29 2010
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
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
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

References

  • Tobias Dantzig, Number: The Language of Science, Macmillan, 1930.
  • Paulo Ribenboim, The New Book of Prime Number Records, Springer-Verlag, 1996, pp. 259-265.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See p. 132.

Crossrefs

Cf. A070076, A001359, A006512, A164292. See A077800 for another version.

Programs

  • Haskell
    a001097 n = a001097_list !! (n-1)
    a001097_list = filter ((== 1) . a164292) [1..]
    -- Reinhard Zumkeller, Feb 03 2014, Nov 27 2011
    
  • Maple
    A001097 := proc(n)
        option remember;
        if n = 1 then
            3;
        else
            for a from procname(n-1)+1 do
                if isprime(a) and ( isprime(a-2) or isprime(a+2) ) then
                    return a;
                end if;
            end do:
        end if;
    end proc: # R. J. Mathar, Feb 19 2015
  • Mathematica
    Select[ Prime[ Range[120]], PrimeQ[ # - 2] || PrimeQ[ # + 2] &] (* Robert G. Wilson v, Jun 09 2005 *)
    Union[Flatten[Select[Partition[Prime[Range[200]],2,1],#[[2]]-#[[1]] == 2&]]] (* Harvey P. Dale, Aug 19 2015 *)
  • PARI
    isA001097(n) = (isprime(n) && (isprime(n+2) || isprime(n-2))) \\ Michael B. Porter, Oct 29 2009
    
  • 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
    
  • 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
    
  • Python
    from sympy import nextprime
    from itertools import islice
    def agen(): # generator of terms
        yield 3
        p, q = 5, 7
        while True:
            if q - p == 2: yield from [p, q]
            p, q = q, nextprime(q)
    print(list(islice(agen(), 58))) # Michael S. Branicky, Apr 30 2022