Section 22.3 Types of Primes
Germain (Subsection 11.6.4)
Mersenne (Subsection 12.1.3)
repunit (Exercise 6.6.1)
Subsection 22.3.1 Twin primes
Consider primes in an arithmetic progressionQuestion 22.3.1.
Consider the following for small values of
Find some primes that look like
for some and several consecutive How many in a row can you do?How about for
What about
Are the primes you get in these cases ever consecutive?
Conjecture 22.3.2. Polignac's Conjecture.
Every even number is the difference between consecutive primes in infinitely many ways.
Conjecture 22.3.3. Twin prime conjecture.
There are infinitely many consecutive odd prime numbers.
Definition 22.3.4.
Pairs of primes
xxxxxxxxxx
def twin_primes_upto(n):
v = prime_range(n+1)
L = []
counter = 0
for i in range(len(v)-1):
if v[i+1]-v[i]==2:
counter += 1
L.append((v[i],v[i+1],counter))
return L
β
twin_primes_upto(100)

Subsection 22.3.2 Heuristics for twin primes
To explain how to get to twin primes, there is a nice little rule of thumb; see e.g. [E.4.5] for what follows. Even though we definitely do not have a proof, we can still give you a good idea of how these ideas come about. First, one might want to estimate how many primes there are up to a certain point to start. The problem is we should use a different idea than just looking at tables! What can we say that is a little smarter?About half the numbers less than
are not divisible by 2.About 2/3 the numbers less than
are not divisible by 3.About 4/5 the numbers less than
are not divisible by 5.Etc. for each prime less than
Although one would expect for 1/4 of all pairs separated by two to both be odd,
has the same parity as so we should expect 1/2 the pairs to both be odd.The chances that
and are both not divisible by three isThe chances that
and are both not divisible by five isAnd so forth.
Remark 22.3.6.
The constant part of this formula is finite, and known as the twin prime constant:
The graphs in Subsection 22.3.1 use this constant (which is built-in in Sage) as well as a logarithmic integral version of the preceding analysis.
There is some inconsistency in the literature about whether the 2 in front of the formula for
Conjecture 22.3.7.
The number of ways to write an even number
Conjecture 22.3.8. Goldbach Conjecture.
Any even number can be written in at least one way as a sum of two primes.
Historical remark 22.3.9. The Pentium bug.
Returning to the twin prime constant, computing it (as in the Sage cell below) led to a very interesting real-life application.
xxxxxxxxxx
2*twinprime.n()
Computing this constant to arbitrary precision led to the discovery of the infamous Pentium chip bug, where some floating-point calculations would be incorrect in high decimal places. This is a quite surprising βapplicationβ of number theory! (It turns out manufacturers do use number-theoretic computations to stress-test their products. See also Historical remark 12.1.8.)
Historical remark 22.3.10. Twin prime status.
It is still unknown whether there are infinitely many twin prime pairs. In a 2013 result that shocked the mathematics world, (then) unknown mathematician Yitang Zhang proved that there exists some
Sage note 22.3.11. Sage can change.
Originally, this constant was included in Sage. However, as nearly every digit of the constant is conjectural, it was removed as a built-in.
xxxxxxxxxx
brun.n(digits=5)
Because Sage is open source, you can follow discussions about decisions and additions to Sage functionality on the Sage developer Trac or sometimes on the Github organization.
Subsection 22.3.3 Other types of primes
In the quest toward Polignac's Conjecture, researchers have dubbed primes (not necessarily consecutive) with spacingAs one example, consider the chance that
and are both not divisible by a given prime Probabilistically, this is basically the same chance as that and are both not divisible by so it turns out that Germain primes might also be distributed in the same fashion as twin primes.-
Using similar ideas, one can get a heuristic that Mersenne primes are distributed as
This is known as Wagstaff's conjecture.
Bizarrely, one can use the same idea to get a heuristic for factorial primes. These are primes of the form
like 5, 7, 23, and 719. It's conjectured that there are such primes less thanThese rules of thumb even seem to apply to the so-called primorial primes β primes of the form
like 3, 5, 7, 29, 31, 211, etc. It's truly weird, yet also cool.