Wolfram Research

Function Repository Resource:

SexyPrimes

Source Notebook

Get the pairs of primes that differ by 6

Contributed by: Wolfram Staff

ResourceFunction["SexyPrimes"][n]

gives the first n pairs of primes that differ by 6.

Examples

Basic Examples

Here are the first 10 pairs of sexy primes:

In[1]:=
ResourceFunction["SexyPrimes"][10]
Out[1]=

Indeed, the differences are 6:

In[2]:=
Differences /@ %
Out[2]=

For reference, here are the first 20 primes:

In[3]:=
Prime[Range[15]]
Out[3]=

Resource History

See Also

License Information