Prime numbers are divisible only by themselves and 1. Primes are the building blocks of the entire number line because all the other numbers are created by multiplying primes together. Thus, primes are the core of arithmetic.
Whether a number is prime or not is pre-determined, as evidenced by innumerous laws already proven. For instance, the prime number theorem states that the average length of the gap between a prime and the next prime is. Such prime gaps have been extensively studied; however many questions and conjectures remain unanswered. In particular, there is no way to predict with certainty which numbers are prime and so, for practical purposes, prime gaps are considered to occur randomly. Actually, the “k-tuple conjecture”  allows for a non-random explanation by estimating how often pairs, triples and larger groupings of primes will appear. The k-tuple conjecture is yet to be proven, but a very recent work  , however, presents a result that contributes to a confirmation of the k-tuple conjecture by finding unexpected biases in the distribution of consecutive primes.
Apart from 2 and 5, all prime numbers end in 1, 3, 7 or 9, and each of the four endings is supposedly equally likely. But the authors in Ref.  find that primes ending in 1 were less likely to be followed by another prime ending in 1. That is unexpected if the primes are truly random. The authors  find that in the first hundred million primes, a prime ending in 1 is followed by another ending in 1 just 18.5 percent of the time. (Incidentally, we confirmed this pattern using a sample of 50,000 prime numbers, but found 15.8 percent of the time instead. Perhaps the difference can be explained by our smaller sample, or perhaps we are right after all and 18.5 is just a typo.) If the primes were distributed randomly, the authors argue that one would expect to see two 1 s next to each other 25 percent of the time. Primes ending in 3 and 7 follow a 1 about 30 percent of the time, while a 9 follows a 1 around 22 percent of instances.
The authors then show that the last-digit pattern can be explained by the groupings given by the k-tuple conjecture. However, as the primes tend to infinity, the pattern vanishes and the primes become genuinely random. Here, we contribute to the literature by presenting further evidence that the k-tuple conjecture can be true. In line with the authors in Ref.  we also find unexpected biases in the distribution of consecutive primes. However, we adopt a statistical physics perspective. The patterns we show to occur come in the form of power laws in the distribution of prime gaps.
There is already substantial literature on primes adopting the statistical physics perspective. In line with our finding, the histograms in the distribution of gaps between primes divided into “congruence families” are shown to be scale invariant  . A theory to explain the origin of the unexpected periodic behavior of gaps between primes has been linked to the k-tuple conjecture, the statistical mechanics of spin systems and the Sierpinski fractal  . Higher-order gaps between the primes have been analyzed by Fourier decomposition to show patterns in the resulting power spectra  . The gaps between primes have been shown to exhibit a period six oscillation  . The histogram of the increments (the difference between two consecutive gaps between primes) has been shown to follow an exponential distribution with superposed periodic behavior of period three  . Rather than prime gaps, for the distribution of primes themselves there have been claims of self-similarity  , small world networks  and even chaos  .
2. Power Law Pattern
As the authors in Ref.  , we investigate whether all the prime numbers ending in 1, 3, 7 or 9 are equally likely. First, we transform the sequence of 50,000 numbers of such four endings into a binary sequence, as in Table 1.
Then we let be the relative frequency of a number to be prime. After, we
Table 1. Binary transform of the sequence of numbers ending in 1, 3, 7 or 9.
consider a Bernoulli random variable such that if is prime and otherwise. Our aim is to find the functional form of the relative frequency. We could observe the occurrences of tend to decrease as grows. This pattern cannot be easily visualized considering a plot of against due to the very fact that our series is a sequence of 0 s and 1 s.
To overcome this difficulty, we devised the following: Assume is a nonstationary Bernoulli process, where the probability of success is not constant. Such a probability can be estimated using a nonlinear Kalman filter  , which linearizes an estimate of the current mean and covariance. Figure 1 (top) shows the estimates of versus, and the bottom shows the adjusted straight line for in red font. It is implied that
Thus, for the probability behaves according to a power law that takes the form:
This power law can be translated in terms of prime gaps, as in Table 2. First note that the prime gap distribution is approximately geometric.
Then, let be a geometric random variable with probability of success. Tentatively consider that “success” is the occurrence of a prime number and that the
Figure 1. Estimations using a nonlinear Kalman filter show the chances of a number to be prime follows a power law (red font).
Table 2. Prime numbers and prime gaps.
successive Bernoulli trials are independent. Thus, the expected number of trials until the occurrence of a subsequent prime is given by:
However, because our Bernoulli process is nonstationary and the Bernoulli trials are not independent, one cannot expect an analytic solution such as that provided by Equation (3) to hold true. But one can empirically determine an analogous substitute for Equation (3) by considering estimates of on the basis of the prime gaps shown in Table 2.
Using the nonlinear Kalman filter for this geometric process, Figure 2 shows the dispersion of estimates of (considering a geometric process) and estimates of
(considering a Bernoulli process). As can be seen, as expected for a typical geometric process. However, the adjusted straight line (in red font) presents the form:
Therefore, prime gaps are proportional to the inverse of the chance of a number to be prime.
Alternatively, consideration of the power law in Equation (2) yields:
Although the difference between two successive prime numbers is casually considered random, the k-tuple conjecture casts doubt on that. The k-tuple conjecture is yet to be
Figure 2. Estimations using a nonlinear Kalman filter show prime gaps follow a power law (red font).
proven, but finding unexpected biases in the distribution of consecutive primes provides confirmation of the k-tuple conjecture. Motivated by a recent mathematical study  , we explain departures from randomness in prime gaps from a statistical physics perspective. The pattern we find that challenges the hypothesis of the genuine random behavior of prime gaps comes in the form of a power law. We find that prime gaps are proportional to the inverse of the chance of a number to be prime.
 Hardy, G.H. and Littlewood, J.E. (1923) Some Problems of “Partitio Numerorum”. III. On the Expression of a Number as a Sum of Primes. Acta Mathematica, 44, 1-70.
 Lemke Oliver, R.J. and Soundararajan, K. (2016) Unexpected Biases in the Distribution of Consecutive Primes.
 Dahmen, S.R., Prado, S.D. and Stuermer-Daitx, T. (2001) Similarity in the Statistics of Prime Numbers. Physica A, 296, 523-528.
 Ares, S. and Castro, M. (2006) Hidden Structure in the Randomness of the Prime Number Sequence? Physica A, 360, 285-296.
 Szpiro, G.G. (2007) Peaks and Gaps: Spectral Analysis of the Intervals between Prime Numbers. Physica A, 384, 291-296.
 Wolf, M. (1999) Applications of Statistical Mechanics in Number Theory. Physica A, 274, 149-157.
 Wolf, M. (1997) 1/f Noise in the Distribution of Prime Numbers. Physica A, 241, 493-499.
 Chandra, A.K. and Dasgupta, S. (2005) A Small World Network of Prime Numbers. Physica A, 357, 436-446.
 Gamba, Z., Hernando, J. and Romanelli, L. (1990) Are Prime Numbers Regularly Ordered? Physics Letters A, 145, 106-108.