# prime number gaps regularities? (Not a mathematician here) I was playing with the gaps $g_n =p_{n+1}-p_{n}$ between first $10^6$ prime numbers, and I made this plot of $(g_n,\;g_{n+1})$ (black dots), and $(g_n,\;g_{n+2})$ (yellow dots). The positions in this plane of a gap with respect to its next gap is interesting and very ordered (black points do not cover all possible positions, but leave holes periodically). This "correlation"(?) is lost for the positions of a gap with respect to its second next (yellow dots cover all positions). Is there a simple explanation?

# in python:
# p : array of first 1e6 prime numbers
import numpy as np
import matplotlib.pyplot as plt
dp = np.diff(p)
plt.plot(dp[:-2], dp[2:], 'y.',ms=15)
plt.plot(dp[:-1], dp[1:], 'k.',ms=7)


## 1 Answer

Yes, for $(g_n,\;g_{n+1})$ certain combination always lead to a composite. For example $(4,4)$. Because all primes $\ge5$ are of the form $6\cdot n \pm1$. For example $(4,4)$ and $6 \cdot n +1$ prime will lead to a $6\cdot n+1+4+4=6\cdot n+9$ and is dividable by 3. When you skip one gap it always possible to get a $6\cdot n \pm1$ again (As you can see in your graph all 6 multiples horizontal and vertical are black).

• so it's all just a consequence of $p=6n\pm1$, thank you. – scrx2 Feb 18 '17 at 19:43