Primality, Fractality, and Image Analysis

This paper deals with the hidden structure of prime numbers. Previous numerical studies have already indicated a fractal-like behavior of prime-indexed primes. The construction of binary images enables us to generalize this result. In fact, two-integer sequences can easily be converted into a two-color image. In particular, the resulting method shows that both the coprimality condition and Ramanujan primes resemble the Minkowski island and Cantor set, respectively. Furthermore, the comparison between prime-indexed primes and Ramanujan primes is introduced and discussed. Thus the Cantor set covers a relevant role in the fractal-like description of prime numbers. The results confirm the feasibility of the method based on binary images. The link between fractal sets and chaotic dynamical systems may allow the characterization of the Hénon map only in terms of prime numbers.


Introduction
The distribution of prime numbers has played an important role in mathematics from the beginning. Nevertheless, the structure of prime numbers has represented a big challenge for generations of mathematicians. In particular, algebraic and analytic features related to the distribution of prime numbers can entail several theoretical problems (the Riemann hypothesis, Goldbach's conjecture, etc.). However, it is not our purpose to investigate the unsolved problems involving prime numbers [1,2].
Prime numbers belong to number theory, that is, pure mathematics. Nevertheless, they can be linked with almost all modern scientific applications, such as those in quantum cryptography [3], biology [4,5], medicine [6], and dynamical systems [7]. Quite recently, considerable attention has been paid to the link between the distribution of prime numbers, fractal geometry, and chaos theory [8][9][10][11]. In particular, the fractal nature of prime-indexed primes (PIPs) has been discussed in [12], where the author has numerically shown the quasi-self similar fractality of finite-differenced PIP sequences. The main result arising from this paper is that order of prime numbers and scale of fractal sets play the same role. In [13] the existence of a link between some prime sequences and the Cantor set is shown. The author investigated Cantor primes, that is, prime numbers p such that 1 p belongs to the Cantor set, providing characterization results. The importance and complexity of the prime distribution led to the development of several techniques for the resolution of unsolved problems. In modern number theory many subsets of the prime numbers (twin primes, Ramanujan primes, Chen primes, etc.) play a relevant role. Thus the fractal nature of prime numbers can be partially determined, showing the fractality of these subsets. The main difficulty in carrying out this technique is that the set of prime numbers cannot currently be partitioned into these subsets. However, the gap between prime numbers seems to be the key point for understanding the structure of prime distribution. In fact, in [14] the author has investigated the possibility of expressing gaps between consecutive primes in terms of the prime counting function. In addition, the same author has shown that the distribution of prime numbers has a powerlike behavior, that is, a long-range dependence. This suggests some kind of self-similarity in prime distribution.
The existence of patchiness in prime distribution can be studied by gaps between consecutive primes. The results of Wolf [11,14] indicate that these patches can be expressed in terms of the prime counting function, which allows a self-similar approximation [15]. Investigation into the nature of these gaps may reveal the hidden structure of prime numbers. For instance, the randomness in prime distribution is linked to the Sierpinski gasket in [10]. All these partial results indicate that the behavior of prime numbers resembles the recursive law of a fractal set. Thus this work is intended to motivate further investigation into the chaoticness of prime numbers.
The main purpose of this paper is to shine new light on the hidden structure of the prime distribution through an investigation in fractal geometry. In particular, the key research question is whether or not the coprimality condition, PIPs, and Ramanujan primes have fractal-like behavior. The approach adopted for this study is based on image analysis. In fact, the construction of a Boolean matrix enables us to define the correspondent correlation matrix, which provides the binary image sought. The results resemble well-known fractal patterns. More precisely, the coprimality condition and Ramanujan primes exhibit behavior based on the Minkowski island and Cantor dust, respectively. Furthermore, PIPs and Ramanujan primes are compared and the results discussed. Cattani and Ciancio [16] showed that the distribution of PIPs is similar to the Cantor dust. The Hénon map, which is related to a Cantor-like set, provides an application in chaotic dynamical systems. Thus the Cantor set seems to play a noteworthy and relevant role in the distribution of prime numbers.
The remainder of the paper is organized as follows. Section 2 presents some preliminaries on PIPs, Ramanujan primes, and Rényi dimension. Section 3 outlines the main results of the binary image linked to both the coprimality condition and Ramanujan primes. Furthermore, the comparison between k-order PIPs and Ramanujan primes is presented and discussed. In Section 4, the Hénon map provides an application in chaotic dynamical systems. Finally, Section 5 summaries the results and concludes with a suggestion for further investigation.

Preliminaries
Throughout this paper and unless otherwise specified, k and n will indicate elements of N = {1, 2, 3, . . .}. Likewise, α and x will always denote real numbers. The greatest common divisor of two integers a and b is denoted by (a, b). In addition, a and b are called coprime (or relatively prime) whenever (a, b) = 1. The cardinality of a set A will be denoted by # A. For the convenience of the reader and for brevity the preliminaries are reported below without proofs [8,17,18], thus making our exposition self-contained.

Prime Numbers, PIPs, and Ramanujan Primes
Let D n be the set given by D n ∶= {k ∈ N ∶ k n}, n ≥ 1 .
It follows immediately that the elements of D n are simply all the positive divisors of n. Any natural number p > 1 is called prime if # D p = 2. For simplicity of notation, let p i (i ≥ 1) stand for the ith prime number. Thus the set of prime numbers is defined as follows: Therefore P = {2, 3, 5, 7, 11, . . .}. Euclid showed that # P = ∞ although the distribution of prime numbers within N is still an open problem. The main result is a (statistical) property called the prime number theorem. This involves the prime counting function, π ∶ R → N, defined by that is, the number of primes less than or equal to a given real number x. Note that P x ⊆ P. Gauss and Legendre conjectured that π(x) asymptotically tends to x log x: Independently, Hadamard and de la Vallée Poussin definitely showed approximation (1), hence the prime number theorem states that Both proofs are based on nonvanishing of the Riemann ζ function on the line σ = 1, that is ζ(1 + it) ≠ 0 for any real t. The introduction of the logarithmic integral Li leads to a better approximation given by which is the current version of the prime number theorem (see [19] for more details). As already mentioned in Section 1, the focus of this paper is the joint investigation on two subsets of P (PIPs and Ramanujan primes). According to [8,20] the sequence of PIPs, that is the sequence of primes with a prime index, is the subset of P given by Note that the subset P 1 can be iteratively generalized as follows: and so on. This entails that for each integer k ≥ 1, the set P k of the k-order PIPs is immediately built. According to the definition of PIPs it follows that P 0 = P. Therefore P k for k = 0, 1, 2 is given by The definition of PIPs entails P k+1 ⊂ P k for any nonnegative integer k. This is consistent with the following approximation shown by Broughan and Barnett [8]. Note that π 2 (x) is the number of PIPs not greater than a given real x. For any integer n ≥ 1, the nth Ramanujan prime is defined as the smallest positive integer R n such that Condition (3) ensures the existence of at least n prime numbers in the interval The minimality entails both that R n is always a prime number and that the interval R n 2 , R n contains exactly n primes [17]. The properties of the gamma function allowed Ramanujan to compute the first five values of R n , showing that The infinitude of PIPs follows directly from approximation (2). A similar approximation shows the infinitude of Ramanujan primes [18].

Fractality and Rényi Dimension
In the last decades, fractal geometry, which plays an important role in modern mathematics, has attracted much attention from research teams. In recent years, there has been a growing interest in the link between fractal geometry and number theory. Fractal sets can often be defined in number theoretic terms. There are different parameters which can used to characterize any fractal set. In particular, fractal dimension and lacunarity [9,21] allow us to investigate the fractal nature of prime sequences.
Recent research on fractal geometry has often been focused on dynamical systems. In fact, previous studies indicate the close link between fractal sets, strange attractors, and entropy [22].
The literature on these topics shows a variety of approaches. In particular, the joint approach has attracted significant attention from many researchers, becoming very popular. The chaoticity can be described by many parameters. Each of them is an index related to the complexity of the system. In particular, the fractal dimension is a noninteger number which describes the irregular shape of fractal sets. There are several definitions of fractal dimension. Investigation along these lines exceeds the scope of this paper. It suffices for our purposes to assume that the fractal dimension coincides with the box-counting dimension. This involves no loss of generality. Let A be a non-empty bounded subset of R n and N δ(A) the smallest number of δ-boxes needed to cover A. The box-counting dimension of A is given [21,23] by whenever the limit (4) exists. Definition (4) entails that the box-counting dimension of A is the minimum number of δ-boxes covering the set A on a uniform grid. The fractal dimension remains the most important parameter in fractal modeling. The box-counting dimension is strongly linked with the concept of entropy. In fact, let X be a discrete alphabet random variable and let N = N(δ) be the total number of δ-boxes with p i > 0. The Rényi dimension, a parameter which describes the multifractality [23,24], is given by reduces to the box-counting dimension for α = 0. It follows immediately that where H α is the Rényi entropy. For a fuller treatment see [24] and the references given there. Fractal sets are mainly characterized by self-similarity and space-filling properties. The concept of lacunarity is related to this second property. In particular, the lacunarity takes into account the texture of a fractal set and describes the distribution of the gaps (lacunae) within it. High values of lacunarity indicate a large size distribution of gaps, that is, a high degree of gappiness. Therefore, the lacunarity draws attention to the homogeneity of a set [9]. High levels of homogeneity correspond to low values of lacunarity, hence the lacunarity provides a valuable idea of the heterogeneity associated with fractal sets. This parameter can be used to distinguish fractal sets with similar fractal dimensions. In other words, fractal dimension and lacunarity play the same role in fractal geometry that mean and variance play in statistics. Nevertheless, lacunarity has been gaining importance in recent years as independent tool to deal with spatial patterns and is often computed by a gliding box algorithm [25].

Binary Image and Primality
First and foremost, our investigation into the hidden nature of P 1 and P R may be carried out by considering them as data sets. The major advantage of this approach is that each data set can be described in terms of entropy. In particular, the concept of information entropy introduced by Shannon [24] allows us to compute the entropy of data sets. The information entropy of a discrete alphabet random variable X defined on the probability space (Ω, B, P) is given by In the previous definition of information entropy, the alphabet size is N and the most common logarithmic bases are b = 2 and b = e. This approach turned out to be inappropriate, as well as a multifractal analysis based on the Rényi dimension (5). In particular, the value of the information entropy does not give us any further information into the hidden structure of prime numbers. Recently, Cattani and Ciancio proposed a new approach to the investigation into the fractality of PIPs [16]. This paper outlines an empiric study on the similarity between the binary image of the PIP (or prime) distribution and Cantor dust. The proposed method is dot-plot based and provides the binary image of these distributions. We now apply this technique to the coprimality condition.
Let S 1 = {i 1 , i 2 , . . . , i k }, S 2 = {j 1 , j 2 , . . . , j k } be two k-length ordered sequences of natural numbers. The indicator function for coprimality is defined by the binary map such that U is a k × k matrix, called the correlation matrix for coprimately and defined as Note that (i m , i n ) ∈ S 1 × S 2 and 1 ≤ m, n ≤ k. The correlation matrix U for the coprimality condition is shown in Table 1. Clearly, whenever S 1 = S 2 , the matrix U is simply the autocorrelation of a k-length sequence. The indicator function allows us to identify hidden symmetries between two given sequences. In particular, any element of U can be mapped into black and white pixels as follows: The result of the mapping (7) is a two-dimensional image I k×k , often called a binary image. In image analysis, any image is a set of pixels adjacent to each other. The binary image can be drawn on a white or black support. The white support holds the mapping (7), where foreground pixels are printed in black and background pixels in white (and conversely on a dark support). The composition of the maps f and (7) given by → I k×k , allows the investigation of the coprimality by fractal geometry. In fact, comparison of Table 1 and Figure 1 (top) shows clearly the presence of the Minkowski island, a variant of the Minkowski curve built on a square. For more details on the Minkowski curve we refer the reader to [26] and the references given there. The lack of some symmetries in Figure 1 (top) might be interpreted as the introduction of randomness in the Minkowski island. Thus the coprimality condition among natural numbers shows a behavior similar to a well-known fractal set. A full discussion requires analytic techniques and lies beyond the scope of this paper. The statement discussed above is confirmed for higher values. In fact, Figure 1 (bottom) shows the coprimality condition for 1 ≤ k ≤ 200. The behavior is still based on the Minkowski island and is in accordance with theory. In fact, the binary image is symmetric with respect to the main diagonal. This comes from the symmetry of the coprimality condition, that is (m, n) = (n, m) for any m, n ∈ N.

PIPs and Ramanujan Primes
In view of all that has been outlined in [16], the PIP distribution seems similar to the Cantor dust. The technique based on the binary map (6) can also be applied to the distribution of Ramanujan primes. The correlation matrix U R can easily be computed by definition (3). This give rise to a Boolean table  like Table 1. Clearly, the matrix U R is nonzero whenever both the components are Ramanujan primes. According to the notation introduced in definition (6) it is Note that S 1 = S 2 = P R and 1 ≤ m, n ≤ k. As with the correlation matrix for coprimality, there is no loss of generality in assuming S 1 = S 2 . Thus the mapping (7) provides the binary image of the Ramanujan primes among the natural numbers, as shown in Figure 2. Like the PIP distribution [16], the distribution of Ramanujan primes looks like the Cantor dust except for some white zones. This lack of symmetry might simply be seen as the presence of randomness in the Cantor dust. The same problem also occurs in the PIP distribution [16]. Let us now define a Cantor prime as any prime number p such that 1 p belongs to the (middle-third) Cantor set. Salas has given a characterization of the Cantor set in terms of prime numbers. In particular, he has shown that any prime number p > 3 if a Cantor prime if and only if it satisfies an equation which involves both p and the order of 3 modulo p (see [13] for more details). Accordingly, fractal geometry seems to play a relevant and hidden role in the distribution of prime numbers. However, more study of the issue is required. Further research into the fractal structure of P 1 and P R should be focused on the main geometric representations of P (sieve of Eratosthenes, Ulam prime spiral, etc.).

Asymptoticity and k-Order PIPs
We conclude this section by showing and discussing the recent asymptotic results on PIPs and Ramanujan primes. As mentioned in Section 2, the density of PIPs is O x log 2 x . This property is an equivalent of the prime number theorem for the PIP distribution. Broughan and Barnett [8] announced that the same holds for the k-order PIPs. Similarly, the results given by Bayless et al. in [20] suggest that where π k (x) denotes the number of k-order PIPs less than or equal to a given real number x. In addition to this, the counting function π k allows explicit bounds. In particular, for any k ≥ 2 there exists a computable x 0 (k) such that The detailed proof can be found in [20]. Note that these bounds are certainly not the best possible. Nevertheless, the finding of better bounds seems difficult from any perspective and related studies are still lacking. Figure 3 shows the behavior of the k-order PIP counting function for k = 1, 2, 3. According to the asymptotic equivalence (8), the family of distributions is strictly decreasing with the order k. Thus the natural question arises regarding the asymptotic comparison between k-order PIPs and Ramanujan primes. Let us denote the counting function of the Ramanujan primes with π R . Note that the main difficulty in carrying out this issue is given by the asymptotic behavior of π R . Sondow [17] and Shevelev [18] showed that Thus the comparison of asymptotic equivalences (8) and (9) assures us that the distribution of Ramanujan primes goes to infinity faster than the k-order PIP distribution. In addition to illustrating the asymptotic behavior, the comparison between k-order PIPs and Ramanujan primes for finite values of x is of interest. Fix a PIP h and consider the subset of P 1 given by H = {3, 5, 11, . . . , h − 1, h} of cardinality n. Figure 4 suggests that the PIP distribution increases more slowly than that of Ramanujan primes, except the values n ≤ 8. All simulations have confirmed this assertion up to n = 1500. Clearly, this is only an empirical clue and far from being a conclusive proof. Summarizing, we may formulate the following Conjecture 1. The distribution of Ramanujan primes increases faster than the k-order PIP distribution except for the first eight elements.
The main difficulty with any eventual proof of Conjecture 1 arises from the lack of results on both PIPs and Ramanujan primes. Note that it has to be based on analytic techniques and will probably appear in a forthcoming publication.

An Application in Dynamical Systems: The Hénon Map
The results given in Section 3 provide an application in dynamical systems. In the literature, the link between dynamical systems and fractal geometry is widely investigated and discussed (see for instance [27] (Ch. 13)). According to Section 3, several studies show the central role of the Cantor set not only in fractal geometry but also in pure and applied mathematics. Likewise, the Hénon map H plays an important role in the theory of dynamical systems. In particular, it is defined as the family of maps H ∶ R 2 → R 2 of the form H (x, y) = 1 + y − ax 2 , bx , where a and b are two real parameters such that a > 0 and b < 1 [28]. Each detailed analysis of H involves several issues and exceeds the scope of this paper. The major drawback occurs in the variation of a and b, which may entail sudden changes in behavior (bifurcations). The Hénon map shows periodicity, mixing, and sensitivity to initial conditions. Hénon dealt with the chaotic behavior of H for a = 1.4 and b = 0.3, called canonical parameter values for the Hénon map. This is illustrated in Figure 5. A multifractal study of H based on the Rényi dimension and the Lyapunov exponent was recently presented in [29]. For b = 0.3 the simulation results indicate the convergence speed of orbits to the attractor for a ∈ [1, 1.4]. Messano et al. [30] showed that all the aperiodic orbits can be removed from the dynamics of H, thus making the new dynamical systems globally convergent. Among all the dynamical systems, the Hénon map has a close link with the Cantor set. The map H can of course be decomposed into an area-preserving bend, a contraction, and a reflection. The contraction suggests the presence of a fractal-like set. In fact, several simulations indicate that the Hénon map is locally the product of a line segment and a Cantor-like set F [27] (p. 196). Numerical results have clearly shown that the box-counting dimension of the attractor is about 1.26 for the canonical parameter values [29]. Summarizing, the simulation results mean simply that there are smooth bijections φ such that where B are small neighbourhoods of the attractor. The results given in Section 3 suggest that F, being a Cantor-like set, may be characterized by a suitable subset of prime numbers. The proof of this conjecture exceeds the scope of this paper. Nevertheless, let us now mention two important consequences. First, note that the role of prime numbers in the theory of chaotic dynamical systems might not be limited to only the description of periodic orbits, becoming a noteworthy parameter of their chaoticity. Second, and perhaps more importantly, the Cantor set and its generalizations are likely to play an increasingly relevant role in number theory, according to recent results [13,15,16].

Conclusions
This paper has investigated the link between fractal geometry and prime numbers. In particular, the study set out to find further confirmation of the fractal nature of prime numbers, as suggested in [10,13,15,16]. The proposed method is based on image analysis. The paper deals with the application of the binary image to three different topics (coprimality, PIPs, and Ramanujan primes), which play a central role in the theory of prime numbers. In all these cases the results, showing a fractal-like behavior, bear out the fractality of prime numbers. In fact, the coprimality condition depicts a binary image based on the Minkowski island. Likewise, the distribution of Ramanujan primes resembles the Cantor dust. In both the above cases, the lack of some symmetries might indicate the presence of randomness. Thus both the binary images may be seen as random fractals. Recently, Cattani and Ciancio [16] have shown that the PIP distribution looks like the Cantor dust. Accordingly, the Cantor set seems to play a relevant role in the hidden structure of prime numbers. In addition, the comparison between k-order PIPs and Ramanujan primes is discussed and the main conclusions are drawn.
The fractal-like behavior of prime numbers enables us to provide an application in chaotic dynamical systems. Being locally given by the smooth bijections (10), that is, by a Cantor-like set, the Hénon map may be described in terms of prime numbers. Therefore the chaoticity of several dynamical systems could be characterized by a suitable subset of P. Further research should be done to build the binary image of other prime subsets (Mersenne primes, twin primes, etc.). Clearly, several other questions remain to be addressed. In particular, the major drawback of this approach is that all these numerical results will require a theoretical proof.