Exploring Prime Patterns in 3D_ Analyzing the `mai - zfifteen/unified-framework GitHub Wiki
The Python script main2.py
offers a rich and creative framework for visualizing deep properties of the integers, especially the elusive distribution of prime numbers. Named "ZetaShift," this code blends mathematical number theory, abstract class design, and modern 3D plotting to reveal familiar and novel geometrical patterns hidden within the primes.
At the heart of the script is the ZetaShift
abstract base class, which encodes the idea of transforming numerical data via a generalized formula $ Z = A \left( \frac{B}{C} \right) $. The implementation, especially in the NumberLineZetaShift
subclass, lets users map values from the number line to new domains—potentially amplifying the effects for prime numbers by using 'prime gap' adjustments. Utility features like primality tests and optional "prime resonance" modes are included, offering both flexibility and mathematical depth.
The script generates a series of striking 3D plots that each approach the mysteries of primes in a different way:
- 3D Prime Geometry Visualization: Numbers are plotted along helical and scaled axes, with primes distinctly marked. This representation makes it easy to identify where primes are "clustered" or "gapped" in contrast to composite numbers.
- Logarithmic Spiral with Prime Angles: Building on the classic spiral visualization, prime numbers are mapped as unique angular displacements, echoing the interplay between growth and cyclicality found in the primes.
- Modular Arithmetic Prime Clusters: Here, integers are sorted into modular "grids" and colored by primality and shared factors. This reveals the symmetrical residue class patterns that underpin modular arithmetic in number theory.
-
Riemann Zeta Landscape: By using the powerful
scipy.special.zeta
function, the script generates a surface of the complex zeta function and highlights the positions of primes on the so-called "critical line." This connects experimental prime data with the grand questions of the Riemann Hypothesis. - Prime Gaussian Spirals: This plot grows a spiral based on cumulative prime-determined angles, threading through "prime-active" points, and visualizing their connections as lines.
- Modular Prime Torus: The final 3D plot wraps numbers around the surface of a torus according to their positions modulo two different bases, visualizing primes as golden stars amid a sea of modular structure. This not only looks beautiful but also reflects deep algebraic properties.
- Primality Testing: A fast and efficient routine is used to check for primes, ensuring that all visualizations remain responsive even for thousands of points.
-
Vectorized Computations: The use of
numpy
vectorization makes for quick calculation of primality arrays and transformed values, critical for high-performance visualization. - Parametric Control: Users can easily tweak parameters (e.g., number of points, helical frequency, modularity bases) to explore new aspects of these structures or zoom in on mathematical phenomena.
While inspired by mathematical giants—such as the connection between spirals and the distribution of primes, and the Riemann zeta function’s role in analytic number theory—this script makes these abstract concepts tangible. Visualizations cast light on hidden order and beautiful structure within prime numbers, inviting students, mathematicians, and enthusiasts to explore number theory in a modern, interactive way.
In sum, main2.py
is much more than a plotting tool: it’s an experimental playground for the visual mathematics of primes. Through creative abstraction, mathematically meaningful coordinate transformations, and rich 3D plots, it helps bring to life the fascinating interplay of randomness, symmetry, and unpredictability at the heart of the primes.