Research Article  Open Access
B. L. Mayer, L. H. A. Monteiro, "A Numerical Study on the Regularity of dPrimes via Informational Entropy and Visibility Algorithms", Complexity, vol. 2020, Article ID 1480890, 5 pages, 2020. https://doi.org/10.1155/2020/1480890
A Numerical Study on the Regularity of dPrimes via Informational Entropy and Visibility Algorithms
Abstract
Let a prime be a positive integer number with divisors. From this definition, the usual prime numbers correspond to the particular case . Here, the seemingly random sequence of gaps between consecutive primes is numerically investigated. First, the variability of the gap sequences for is evaluated by calculating the informational entropy. Then, these sequences are mapped into graphs by employing two visibility algorithms. Computer simulations reveal that the degree distribution of most of these graphs follows a power law. Conjectures on how some topological features of these graphs depend on are proposed.
1. Introduction
Prime numbers, the building blocks of any positive integer, fascinate math lovers [1, 2]. From a purely theoretical perspective, primes are crucial for understanding the properties of numbers [1, 2]. From an applied science perspective, primes have been used in cryptographic keys [3], can be found in the life cycles of cicadas [4], and characterize the energy spectrum of chaotic quantum systems [5].
Since 300 BC, the irregular distribution of primes throughout the sequence of natural numbers has been extensively investigated. Giants as Chebyshev, Dirichlet, Eratosthenes, Erdös, Euclid, Euler, Fermat, Gauss, Legendre, and Riemann analyzed this matter [1, 2]. To get some insight on this distribution, the statistical properties of the gaps between consecutive primes [6, 7], secondorder gaps (the gaps between these gaps), and higherorder gaps [8, 9] have been examined. The distribution of primes has also been studied by using graphs. For instance, consider that primes are the nodes of a graph. Since any even number can be written as the sum of two primes, a pair of nodes is linked in this graph if it represents the sum of a given even number [10]. In another graphbased approach, the natural numbers are the nodes, and there is a connection between two nodes if they share a common prime divisor [11]. Graphs are also used in this work.
Assume that a prime is a positive integer with divisors. Therefore, the usual prime numbers correspond to the case . In this work, the frequency of the gaps between primes is computationally analyzed. First, the difference of successive primes is calculated for , and the gap sequences thereby obtained are considered as discrete time series. To evaluate their variability, the informational entropy [12] of these series is computed. In addition, these series are transformed into undirected graphs by applying two visibility algorithms [13, 14]. The degree distribution and the average degree of these graphs are determined and compared. These are the main contributions of this work, which are described in the next section.
The aim of this study based on primes is to understand how the gap sequences depend on . The proposed approach can be used to analyze other sequences of numbers found in nature [15], such as the energy levels of atomic nuclei and the quantum spacetime structure [16].
2. Methodology and Numerical Results
Let a prime be defined as a positive integer greater than 1 that is divisible by 1, the number itself, and (smaller) positive integers. Thus, a prime has exactly distinct divisors. For instance, number 12 is a 6prime because its (six) divisors are 1, 2, 3, 4, 6, and 12. A prime with is usually called a composite number [1, 2]. Note that the 2primes are just the usual primes. Thus, prime is a naive generalization of the concept of prime number.
Let be the ^{th}prime, with . For instance, is the fourth 3prime, which is equal to 49. Table 1 presents a list of the first primes for . Let be the gap between consecutive primes. For instance, because and . Note that the sequence can be taken as a time series, in which corresponds to the time variable. Table 2 shows the first numbers of the series for .


In order to evaluate the variability of the series for , the informational entropy [12] was computed. This entropy has been calculated, for instance, in investigations on the dynamics of biological [17] and social systems [18]. Its normalized value, denoted by , is given by
The entropy and its maximum value (obtained in the case of for [12]) are calculated by taking as the relative frequency of occurrence of distinct . In these expressions, is the number of distinct values of .
As the next step, the time series were converted into undirected graphs by using two visibility algorithms [13, 14]. These algorithms have been employed, for instance, in the analysis of stock indices [19] and electroencephalography recordings [20]. Here, in the visibility graphs, each node represents a distinct value of .
Consider that . In the natural visibility (NV) graph [13], the nodes corresponding to and are connected if any intermediate point in the time series satisfies the inequality
Thus, these nodes are connected if there is a straight line joining and in the plot , provided that any intermediate point is below such a line. For instance, the four first points of the sequence shown in Table 2 are , , , and . There is a connection between the nodes corresponding to and because the intermediate datum is below the straight line linking these points in the plot , that is, because . Also, note that there is not a connection between the nodes and because . In this case, the datum (2, 16) is high enough to prevent the data (1, 5) and (3, 24) from seeing each other.
In the horizontal visibility (HV) graph [14], the nodes associated with and are connected ifwith . Thus, these nodes are connected if any intermediate point in the plot is below the horizontal line joining and . In the HV graph built from the beginning of the sequence , the nodes corresponding to and are not connected because ; that is, and cannot see each other because is high enough to block their horizontal visibility. Thus, and are connected in the NV graph, but they are not connected in the HV graph.
Numerical experiments were performed by taking , that is, the first 10,000 primes for each value of . From these 10,000 primes, 9999 values of were computed. The values corresponding to were discarded in order to neglect the initial transient and the effects of truncation .
The normalized entropy was computed by using equation (1). As shown in Table 3, for , and 11 because there is no repeated value of in the corresponding sequences. For and , ; for even, . Hence, for , odd favors equiprobable values of more than even.

From the gap sequences for , undirected visibility graphs were built by using equations (2) and (3). Then, the corresponding degree distributions and the average degree were determined. Recall that the degree of a node is the number of edges connected to this node [21]. Recall also that the degree distribution expresses how the percentage of nodes with degree varies with [21]. Usually, is interpreted as the probability of randomly picking a node with degree .
Figures 1 and 2 exhibit the loglog plot of for NV and HV graphs, respectively, for . Observe that most decay as a power law in these plots. Power laws have been found in the distribution of prime gaps [22] and in a myriad of contexts, such as a psychiatric ward [23] and financial crashes [24]. Here, is proportional to taken to the power , that is, , in which is the proportionality constant. In a loglog plot, ; thus, the powerlaw dependence is transformed into a linear relation between and . At least as a first approximation, this relation can be taken as linear in most plots shown in both figures; that is, a powerlaw form for can be considered a plausible model for these plots. Possible exceptions are the NV plots for .
Tables 4 and 5 present , , and for the 20 graphs. The average degree for the HV graphs is smaller than that for the NV graphs because HV graphs are subgraphs of the corresponding NV graphs. For the NV graphs, , with the exception of , which present higher values. For the HV graphs, for odd and for even. Note also that the values of and , determined from least square fitting [25], present smaller variability for the HV graphs than for the NV graphs. In addition, for the NV graphs, ; for the HV graphs, .


By reducing the quantity of primes used in this computational study from to , the values of , , , and vary about 1% on average as compared to the numbers presented in Tables 3 and 5. For the results shown in Table 4, larger variations are found for and , the parameters of the fitted straight lines; the variations related to are also about 1% on average, with the exception of .
From the numerical experiments reported in this work, the following relations were found: , , , and ; thus, 3primes, 5primes, 7primes, and 11primes are just powers of prime numbers with powers 2, 4, 6, and 10, respectively. However, no relation between and with was found; that is, no relation was found between prime numbers and primes when is not prime.
3. Discussion and Conclusion
The absence of a discernible pattern in the sequence of prime numbers has historically hampered the derivation of a formula for correctly generating such a sequence [1, 2]. The analytical generation of primes, with , can be an even more challenging task mainly if is not prime. Here, the distribution of the gaps between primes was examined by using a variability measure and two visibility graphs, which were deterministically built.
As shown in Table 3, for because repetitions in the sequences of are absent or rare; that is, these sequences are aperiodic. In addition, for ; thus, the variability of the gap lengths for even is lower than for odd. Therefore, a possible conjecture is: the normalized entropy distinguishes even from odd . In other words, the parity of determines the value of .
As shown in Figures 1 and 2 and Tables 4 and 5, most degree distributions of the visibility graphs built from the differences between successive primes for approximately follow a power law written as . Fluctuations observed around the fitted straight lines shown in both figures can be effects of the finite size of the gap sequences used in the numerical experiments [26]. Recall that powerlaw distributions in the connectivity are associated with complex networks known as scalefree [26–28]. Scale invariance in the degree distribution implies selfsimilarity; that is, of renormalized networks, obtained by a coarsegraining procedure [29], also follows a power law. Note that the value of in the NV and HV plots is not a good parameter to show the influence of the value of on the networks derived from the gap sequences; however, can highlight this influence: in NV plots, for that is prime, increases with ; for that is not prime, ; in HV plots, for odd and for even. Therefore, another possible conjecture is: in NV plots distinguishes that is prime from that is not prime; in HV plots distinguishes odd from even.
It is well known that, for HV graphs obtained for periodic sequences of period (without repeated number within a period), the average degree is given by [30]. As a consequence, for aperiodic series, (because ). According to Table 5, this is the approximate value of found for primes with odd, which is in agreement with the value of presented in Table 3. It is also well known that, for an uncorrelated random sequence, the HV graph has [30]. Therefore, deviations from this degree distribution reveal that the studied sequence was not generated by an uncorrelated random process. The straight line corresponding to is shown as a dotted line in Figure 2. Note that for primes has a smaller slope than the slope of . This smaller slope and can be features of chaotic sequences [30].
A final comment about the generation of primes by deterministic equations: when is prime, then ; however, the way of obtaining when is not prime is not yet evident. Also, a formula to generate (the exact sequence of primes) remains to be found.
Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.
Conflicts of Interest
The authors declare that there are no conflicts of interest regarding the publication of this paper.
Acknowledgments
BLM thanks to Instituto Presbiteriano Mackenzie for the scholarship. LHAM is partially supported by Conselho Nacional de Desenvolvimento Científico e Tecnológico (CNPq) under grant #304081/20183. This study was financed in part by Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (CAPES)—finance code 001.
References
 G. H. Hardy and E. M. Wright, “An Introduction to the Theory of Numbers,” Oxford University Press, Oxford, UK, 2008. View at: Google Scholar
 H. G. Diamond, “Elementary methods in the study of the distribution of prime numbers,” Bulletin of the American Mathematical Society, vol. 7, no. 3, pp. 553–590, 1982. View at: Publisher Site  Google Scholar
 U. M. Maurer, “Fast generation of prime numbers and secure publickey cryptographic parameters,” Journal of Cryptology, vol. 8, no. 3, pp. 123–155, 1995. View at: Publisher Site  Google Scholar
 J. Yoshimura, T. Hayashi, Y. Tanaka, K.I. Tainaka, and C. Simon, “Selection for primenumber intervals in a numerical model of periodical cicada evolution,” Evolution, vol. 63, no. 1, pp. 288–294, 2009. View at: Publisher Site  Google Scholar
 M. V. Berry and J. P. Keating, “The riemann zeros and eigenvalue asymptotics,” SIAM Review, vol. 41, no. 2, pp. 236–266, 1999. View at: Publisher Site  Google Scholar
 E. Bombieri and H. Davenport, “Small differences between prime numbers,” Proceedings of the Royal Society of London Series A, vol. 293, no. 1432, pp. 1–18, 1966. View at: Publisher Site  Google Scholar
 S. Ares and M. Castro, “Hidden structure in the randomness of the prime number sequence,” Physica A: Statistical Mechanics and its Applications, vol. 360, no. 2, pp. 285–296, 2006. View at: Publisher Site  Google Scholar
 G. G. Szpiro, “The gaps between the gaps: some patterns in the prime number sequence,” Physica A: Statistical Mechanics and its Applications, vol. 341, pp. 607–617, 2004. View at: Publisher Site  Google Scholar
 G. G. Szpiro, “Peaks and gaps: spectral analysis of the intervals between prime numbers,” Physica A: Statistical Mechanics and its Applications, vol. 384, no. 2, pp. 291–296, 2007. View at: Publisher Site  Google Scholar
 A. K. Chandra and S. Dasgupta, “A small world network of prime numbers,” Physica A, vol. 357, no. 34, pp. 436–446, 2005. View at: Publisher Site  Google Scholar
 G. Corso, “Families and clustering in a natural numbers network,” Physical Review E, vol. 69, no. 3, Article ID 036106, 2004. View at: Publisher Site  Google Scholar
 C. Shannon and W. Weaver, “The Mathematical Theory of Communication,” University of Illinois Press, Chicago, IL, USA, 1949. View at: Google Scholar
 L. Lacasa, B. Luque, F. Ballesteros, J. Luque, and J. C. Nuño, “From time series to complex networks: the visibility graph,” Proceedings of the National Academy of Sciences, vol. 105, no. 13, pp. 4972–4975, 2008. View at: Publisher Site  Google Scholar
 B. Luque, L. Lacasa, F. Ballesteros, and J. Luque, “Horizontal visibility graphs: exact results for random time series,” Physical Review E, vol. 80, no. 4, Article ID 046103, 2009. View at: Publisher Site  Google Scholar
 K. Soundararajan, “Small gaps between prime numbers: the work of GoldstonPintzYildirim,” Bulletin of the American Mathematical Society, vol. 44, no. 1, pp. 1–19, 2007. View at: Publisher Site  Google Scholar
 N. G. Sanchez, “New quantum structure of spacetime,” Gravitation and Cosmology, vol. 25, no. 2, pp. 91–102, 2019. View at: Publisher Site  Google Scholar
 J. R. C. Piqueira, F. A. Serboncini, and L. H. A. Monteiro, “Biological models: measuring variability with classical and quantum information,” Journal of Theoretical Biology, vol. 242, no. 2, pp. 309–313, 2006. View at: Publisher Site  Google Scholar
 V. M. Netto, J. Meirelles, and F. L. Ribeiro, “Social interaction and the city: the effect of space on the reduction of entropy,” Complexity, vol. 2017, Article ID 6182503, 16 pages, 2017. View at: Publisher Site  Google Scholar
 D. R. Chen, C. Liu, Y. C. Zhang, and Z. K. Zhang, “Predicting financial extremes based on weighted visual graph of major stock indices,” Complexity, vol. 2019, Article ID 5320686, 2019. View at: Publisher Site  Google Scholar
 L. Wang, X. Long, J. B. A. M. Arends, and R. M. Aarts, “EEG analysis of seizure patterns using visibility graphs for detection of generalized seizures,” Journal of Neuroscience Methods, vol. 290, pp. 85–94, 2017. View at: Publisher Site  Google Scholar
 C. Gros, “Complex and Adaptive Dynamical Systems: A Primer,” Springer, New York, NY, USA, 2008. View at: Google Scholar
 R. Matsushita and S. Da Silva, “A power law governing prime gaps,” Open Access Library Journal, vol. 3, no. 9, Article ID e2989, 2016. View at: Publisher Site  Google Scholar
 J. R. C. Piqueira, L. H. A. Monteiro, T. M. C. De Magalhães, R. T. Ramos, R. B. Sassi, and E. G. Cruz, “Zipf’s law organizes a psychiatric ward,” Journal of Theoretical Biology, vol. 198, no. 3, pp. 439–443, 1999. View at: Publisher Site  Google Scholar
 B. C. Dai, F. Zhang, D. Tarzia, and K. Ahn, “Forecasting financial crashes: revisit to logperiodic power law,” Complexity, vol. 2018, Article ID 4237471, 2018. View at: Publisher Site  Google Scholar
 L. Ljung, “System Identification: Theory for the User,” PrenticeHall, Upper Saddle River, NJ, USA, 1998. View at: Google Scholar
 A. D. Broido and A. Clauset, “Scalefree networks are rare,” Nature Communications, vol. 10, no. 1, Article ID 1017, 2019. View at: Publisher Site  Google Scholar
 E. F. Keller, “Revisiting “scalefree” networks,” BioEssays, vol. 27, no. 10, pp. 1060–1068, 2005. View at: Publisher Site  Google Scholar
 M. Newman, “Power laws, pareto distributions and Zipf’s law,” Contemporary Physics, vol. 46, no. 5, pp. 323–351, 2005. View at: Publisher Site  Google Scholar
 C. Song, S. Havlin, and H. A. Makse, “Selfsimilarity of complex networks,” Nature, vol. 433, no. 7024, pp. 392–395, 2005. View at: Publisher Site  Google Scholar
 A. Nuñez, L. Lacasa, E. Valero, J. P. Gomez, and B. Luque, “Detecting series periodicity with horizontal visibility graphs,” International Journal of Bifurcation and Chaos, vol. 22, no. 7, Article ID 1250160, 2012. View at: Publisher Site  Google Scholar
Copyright
Copyright © 2020 B. L. Mayer and L. H. A. Monteiro. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.