
1. Introduction
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” [1] 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 [2] , 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. [2] 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 [2] 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. [2] 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 [3] . 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 [4] . Higher-order gaps between the primes have been analyzed by Fourier decomposition to show patterns in the resulting power spectra [5] . The gaps between primes have been shown to exhibit a period six oscillation [6] . 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 [7] . Rather than prime gaps, for the distribution of primes themselves there have been claims of self-similarity [8] , small world networks [9] and even chaos [10] .
2. Power Law Pattern
As the authors in Ref. [2] , 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 [11] , 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
(1)
Thus, for
the probability
behaves according to a power law that takes the form:
. (2)
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:
. (3)
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:
. (4)
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:
. (5)
3. Conclusion
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 [2] , 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.