### Basic Examples

Basic Examples

Here are the first 10 pairs of twin primes:

[10]

In[]:=

{{3,5},{5,7},{11,13},{17,19},{29,31},{41,43},{59,61},{71,73},{101,103},{107,109}}

Out[]=

Indeed, the differences are 2:

Differences/@%

In[]:=

{{2},{2},{2},{2},{2},{2},{2},{2},{2},{2}}

Out[]=

For reference, here are the first 30 primes:

Prime[Range[30]]

In[]:=

{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113}

Out[]=

### Neat Examples

Neat Examples

The sum of the reciprocals of the primes diverges:

Sum[1/Prime@n,{n,∞}]

In[]:=

∞

∑

n

1

Prime[n]

Out[]=

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:

Total1.Flatten@

[10^5]

In[]:=

1.74433

Out[]=

This is the last pair in that sum:

Last@

[10^5]

In[]:=

{18409199,18409201}

Out[]=