Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get the pairs of primes that differ by 2
ResourceFunction["TwinPrimes"][n] gives the first n pairs of primes that differ by 2. |
Here are the first 10 pairs of twin primes:
In[1]:= |
Out[1]= |
Indeed, the differences are 2:
In[2]:= |
Out[2]= |
For reference, here are the first 30 primes:
In[3]:= |
Out[3]= |
The sum of the reciprocals of the primes diverges:
In[4]:= |
Out[4]= |
In 1919, Brun proved that the sum of the reciprocals of the twin primes converges. The sum, Brun's constant, is around 1.9. Here is the sum of the reciprocals of the first 100,000 twin primes:
In[5]:= |
Out[5]= |
This is the last pair in that sum:
In[6]:= |
Out[6]= |
This work is licensed under a Creative Commons Attribution 4.0 International License