Skip to content

PrimePairs ​

The lesser prime pp of a pair (p,p+gap)(p, p+gap), both prime -- gapgap selects the family (22=twin, 44=cousin, 66=sexy, …), as a lazy indexed family.

PrimePairs(gap)the prime pp with p+gapp+gap also prime, an indexed collection of open infinitude for every gapgap.
Typed signatures
TypePackageApplies
(integer<0..>) -> indexed_collection<integer>combinatoricsalways

Domain: Collections

Details
  • A lazy indexed collection for each gapgap; whether there are infinitely many prime pairs at ANY fixed gap is open (the twin-prime conjecture generalises to every gap), so Count(PrimePairs(gap))=NaNCount(PrimePairs(gap)) = NaN for every gapgap, not just gap=2gap=2.
  • PrimePairs(2)PrimePairs(2), PrimePairs(4)PrimePairs(4), PrimePairs(6)PrimePairs(6) are TwinPrimes, CousinPrimes, SexyPrimes verbatim.
  • At(PrimePairs(gap),i)At(PrimePairs(gap), i) unranks the ii-th match by scanning forward, testing primality of nn and n+gapn+gap -- At(PrimePairs(4),1)=3At(PrimePairs(4), 1) = 3.
  • Membership goes through Element: Element(3,PrimePairs(4))Element(3, PrimePairs(4)) is true (3,73,7 both prime), Element(5,PrimePairs(4))Element(5, PrimePairs(4)) is false (99 is not).

Enumeration

Examples

1 more kept as data, checked against the oracles
About
Examples1

See also: Count, At, Element, TwinPrimes, CousinPrimes, SexyPrimes