Skip to main content
\( \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)

Section22.3Types of Primes

There are many types of primes we have encountered up to this point. For instance:

Notice that for many of these types, we don't know if there are finitely many or not! Are there any conjectures for how often certain types of primes might appear?

Subsection22.3.1Twin primes

Consider primes in an arithmetic progression \(ax+b\). Can one say anything about the constants involved in these progressions? Since \(b\) is pretty arbitrary, we would focus on \(a\). Here are some natural questions to consider for small values of \(a\).

Question22.3.1

  • Find some primes that look like \(2x+b\) for some \(b\) and several consecutive \(x\). How many \(x\) in a row can you do?

  • How about for \(3x+b\)?

  • What about \(4x+b\)?

  • Are the primes you get in these cases ever consecutive?

Hopefully it's pretty clear that you can't do every possible combination of \(b\) and \(a\), nor can every such progression go on indefinitely! Why?

Thinking about this and the Sieve of Eratosthenes led the French mathematician Alphonse de Polignac to the following.

We have no proof of this. In fact, even the most basic case of Polignac's conjecture is one of the most celebrated open questions in number theory – celebrated enough that well-known comedian Stephen Colbert interviewed Fields medalist Tao about it.

Definition22.3.4

Pairs of primes \(p\) and \(q\) such that \(p+2=q\) are called twin primes.

There are lots of twin primes. The following cell computes twin prime pairs, numbered by which twin prime pair it is. The pair 17 and 19 is the fourth pair, for example.

We can use similar searching to try to see whether there are enough that there are infinitely many

You can see in the preceding graphic that it's certainly possible to approximate the twin prime counting function in a similar way to how we approximated the prime counting function \(\pi\). There is a mysterious constant I've used; it will be explained below.

Subsection22.3.2Heuristics for twin primes

To explain how to get to twin primes, there is a nice little rule of thumb; see e.g. [C.3.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 \(n\) are not divisible by 2.

  • About 2/3 the numbers less than \(n\) are not divisible by 3.

  • About 4/5 the numbers less than \(n\) are not divisible by 5.

  • Etc. for each prime less than \(\sqrt{n}\ldots\)

If we take this thinking to its logical extreme, you might even expect that \begin{equation*}\prod_{p<\sqrt{x}}\left(1-\frac{1}{p}\right)\end{equation*} is a good approximation of the probability that a given number \(x\) is prime. Unfortunately, it isn't. In fact, this product turns out to be asymptotic to \(2e^{-\gamma}/\log(x)\) (recall that \(\gamma\) from Definition 20.3.2).

Still, this kind of thinking is still helpful, and might help us make ideas for how many twin primes there are – especially if we keep in mind this isn't really a probability. After all, if \(p>2\) is prime, then with one hundred percent probability the next number is not prime! And for \(p\) and \(p+2\) to be both prime, they must also both be odd; so if \(p\) is odd, then \(p+2\) is much more likely than a random number to be prime.

So we do the following analysis instead. (See Exercises 22.4.11 and 22.4.12.)

  • Although one would expect for 1/4 of all pairs separated by two to both be odd, \(n+2\) has the same parity as \(n\) so we should expect 1/2 the pairs to both be odd.

  • The chances that \(n\) and \(n+2\) are both not divisible by three is \(1/3\).

  • The chances that \(n\) and \(n+2\) are both not divisible by five is \(3/5\).

  • And so forth.

So, having gotten a little more sophisticated, we might expect that \begin{equation*}\frac{1}{2}\prod_{p<\sqrt{x},p>2}\left(1-\frac{2}{p}\right)\end{equation*} is a decent approximation of the probability that a given pair of consecutive odd numbers are both prime.

This doesn't look so recognizable yet, but we can do some algebra to turn this into something that looks better and has logarithms, just like in the prime number theorem. If we substitute \begin{equation*}\left(1-\frac{2}{p}\right)=\left(1-\frac{1}{(p-1)^2}\right)\left(1-\frac{1}{p}\right)^2\end{equation*} then the approximation of the number of twin primes less than \(x\) looks more like this:\begin{equation*}\frac{1}{2}\prod_{p<\sqrt{x},p>2}\left(1-\frac{1}{(p-1)^2}\right)\prod_{p\text{ prime}}\left(1-\frac{1}{p}\right)^2\end{equation*} Finally, if we now use the earlier suggestion about the right-hand side being more or less the square of the number of primes, we come up with a reasonable suggestion that looks more familiar. \begin{equation*}\frac{1}{2}\prod_{p<\sqrt{x},p>2}\left(1-\frac{1}{(p-1)^2}\right)\left(\frac{x}{\log(x)}\right)^2\end{equation*}

Remark22.3.5

The constant part of this formula is finite, and known as the twin prime constant: \begin{equation*}C_2=2\prod_{p>2}\left( 1-\frac{1}{p-1}^2\right)\, .\end{equation*} 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 \(C_2\) is part of the twin prime constant or not.

This also leads to a conjecture of Hardy and Littlewood.

This would provide a very overwhelming proof of the following old suggestion, going back to correspondence between Euler and Goldbach.

In fact, there are two such conjectures, with the other one suggesting that any positive integer may be written as a sum of three primes.

Returning to the twin prime constant, computing it (as in the Sage cell below) led to a very interesting real-life application.

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.)

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 \(N\) less than seventy million such that there are infinitely many pairs of primes separated by exactly \(N\). This was a huge improvement over previous results, and further work of an unusually collaborative nature have now reduced this bound to \(N\leq 246\).

As we finish this subsection, we must mention another constant affiliated with twin primes. Although there may really be infinitely many pairs, the sum of their reciprocals \begin{equation*}\sum_{p,p+2 \text{ both prime}} \frac{1}{p}+\frac{1}{p+2}\end{equation*} is still a finite constant. At the very least means twin primes must be pretty rare. This (possibly infinite) sum is called Brun's constant, and is also in Sage.

Subsection22.3.3Other types of primes

In the quest toward Polignac's Conjecture, researchers have dubbed primes (not necessarily consecutive) with spacing \(N=4\) cousin primes and those \(N=6\) apart sexy primes. In another result of similar vintage to Zhang's (and also collaborative like its refinement), we know (conditional upon the so-called “generalized Elliott-Halberstam conjecture”, which is closely related to our investigations in Subsection 22.2.2) that at least one of the classes of twin, cousin, or sexy primes is infinite 1 . This is a very special case of exploring something called prime constellations; see Exercise 22.4.13.

In addition, there are many other heuristics like the ones above. Here is a sampling of those we don't have space or expertise in this text to dig further into.

  • As one example, consider the chance that \(n\) and \(2n+1\) are both not divisible by a given prime \(p\). Probabilistically, this is basically the same chance as that \(n\) and \(n+2\) are both not divisible by \(p\), 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 \begin{equation*}e^{\gamma}\log(\log(x))/\log(2)\end{equation*} 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 \(n! \pm 1\), like 5, 7, 23, and 719. It's conjectured that there are \(e^{\gamma}\log(n)\) such primes less than \(n\).

  • These rules of thumb even seem to apply to the so-called primorial primes – primes of the form \(p\#\pm 1\), like 3, 5, 7, 29, 31, 211, etc. It's truly weird, yet also cool.

There is so much to explore! There is never a lack of questions for mathematicians to explore when it comes to prime numbers.