Skip to content

TwinPrimes ​

The (lesser) twin primes 3,5,11,17,29,…3, 5, 11, 17, 29, …: primes pp with p+2p+2 also prime.

TwinPrimesthe lesser prime pp of a twin pair (p,p+2)(p, p+2), an indexed collection of open infinitude.

Domain: Collections

Details
  • A lazy indexed collection; whether there are infinitely many is the open twin-prime conjecture, so Count(TwinPrimes)=NaNCount(TwinPrimes) = NaN rather than +∞+\infty -- a deliberately different answer from every +∞+\infty family in this library, marking a genuinely open question rather than a known-infinite one. OEIS A001359 (the LESSER member; A001097 lists both members of each pair instead).
  • At(TwinPrimes,k)At(TwinPrimes, k) unranks by scanning forward, testing primality of nn and n+2n+2 -- At(TwinPrimes,3)=11At(TwinPrimes, 3) = 11.
  • Membership goes through Element: Element(11,TwinPrimes)Element(11, TwinPrimes) is true (11,1311, 13 both prime), Element(13,TwinPrimes)Element(13, TwinPrimes) is false (1515 is not).
  • TwinPrimesTwinPrimes is PrimePairs(2)PrimePairs(2) verbatim.

Enumeration

Examples

Basic #

The first 20 lesser twin primes, OEIS A001359

live ↗
InTake(TwinPrimes,20)\mathrm{Take}(\mathrm{TwinPrimes}, 20)Out[3,5,11,17,29,41,59,71,101,107,137,149,179,191,197,227,239,269,281,311]\bigl\lbrack3, 5, 11, 17, 29, 41, 59, 71, 101, 107, 137, 149, 179, 191, 197, 227, 239, 269, 281, 311\bigr\rbrack

Count(TwinPrimes)Count(TwinPrimes) is unknown, but the first 20 exist, so a prefix counts exactly

live ↗
InCount(Take(TwinPrimes,20))\mathrm{Count}(\mathrm{Take}(\mathrm{TwinPrimes}, 20))Out2020
Properties #
live ↗
In11∈TwinPrimes11∈\mathrm{TwinPrimes}OutTrue\mathrm{True}

13 is not -- 13+2=1513+2=15 is not prime

live ↗
In13∈TwinPrimes13∈\mathrm{TwinPrimes}OutFalse\mathrm{False}
About
Examples4
CrosswalkOEIS

See also: Count, At, Element, PrimeNumbers, CousinPrimes, SexyPrimes, PrimePairs