October 13, 2019
The significance of prime numbers, in both everyday applications & as a subtopic pertinent to all branches of math, cannot be overstated. We quietly rely on their special properties to carry the backbone of countless parts of our society — all because they are an irreducible part of the very fabric of nature. Resistant to any further factorization, prime numbers are often referred to as the “atoms” of the math world. As Carl Sagan so eloquently describes them:
There’s a certain importance to prime numbers’ status as the most fundamental building blocks of all numbers, which are themselves the building blocks of our understanding of the universe.
The use of prime numbers in nature & in our lives are everywhere: cicadas time their life cycles by them, clock-makers use them to calculate ticks, & aeronautical engines use them to balance frequency of air pulses. However, all of these use-cases pale in comparison to the one fact every cryptographer is familiar with: prime numbers are at the very heart of modern computational security, which means prime numbers are directly responsible for securing pretty much everything. See that lock in the URL bar? Yeap, a two-key handshake powered by primes. How is your credit card protected on purchases? Again, encryption powered by primes.
Yet for our consistent reliance on their unique properties, prime numbers have remained infamously elusive. Throughout the history of math, the greatest minds have attempted to prove a theorem for predicting which numbers are prime, or, how apart successive primes are in placement. In fact, a handful of unsolved problems such as Twin Primes, Goldbach Conjecture, Palindromic Primes, & The Riemann Hypothesis all revolve around this general unpredictability & uncertainty in prime numbers as they approach infinity. Granted, since the early days of Euclid we’ve found a handful algorithms that predict some placement, but general theorems haven’t been accepted nor did previous attempts have the tools to test large numbers. 21st-century technology, however, does allow researchers to test proposals with extremely large numbers, but that method alone invites controversy as brute-force testing isn’t quite globally accepted as a solid proof. In other words, primes have resisted any universal formula or equation, their appearance in nature remaining a status of seemingly-random.
As It Turns Out However, A Simple Scribble Proves That They’re At Least Not Completely Random…
One of the greatest proofs we have that the appearance of prime numbers is no mere coincidence came from one of the most unlikeliest places: the effortless & accidental doodles of one bored lecture attendee.
As the story goes, one Polish mathematician, Stanislaw Ulam, stumbled upon a visual pattern in 1963 during a seminar. While drawing a grid of lines, he decided to number the intersections according to a square-spiral pattern, & then began circling the numbers in the spiral that were primes. Surprisingly, the circled primes appeared to fall along a number of diagonal straight lines or, in Ulam’s slightly more formal prose, it:
Appears To Exhibit A Strongly Nonrandom Appearance
The Ulam Spiral, or prime spiral, is the resultant graphical depiction from marking the set of prime numbers in a square-spiral. It was originally published & reached the mainstream through Martin Gardner’s Mathematical Games column in Scientific American.
The visualization above clearly highlights significant patterns, especially diagonally. But maybe we’re deceiving ourselves? A common counter to the Ulam spiral is that perhaps our brain is simply tricking us into assigning these patterns in randomness. Luckily, we can take two different approaches to confirm that this isn’t the case. Both a visual comparison & a logical walk-through will convince one that they’re certainly not random. First, we’ll compare an Ulam spiral made by a matrix of NxN dimensions, to an equally-sized NxN matrix containing randomly-assigned dots. Second, we’ll flex our knowledge of polynomials to reason through exactly why we should expect some pattern in the visual layout of primes.
As mentioned, the likely most intuitive way to confirm a non-random pattern with a Ulam spiral is through a direct comparison. This is done by creating both a Ulam spiral & a spiral with random placements of the same size. Below are two different 200x200 matrices that represent numerical spirals:
By visual comparison it’s fairly obvious that the Ulam spiral contains striking patterns, particularly along certain diagonal axes; additionally, there is little, if any clustering. On the other hand, the random placement of dots does not yield any immediately-obvious patterns — rightly resulting in multi-directional clustering. Incontrovertibly, this lacks the rigor of traditional proofs; however, there’s something pure in visualizing prime spirals, a method inattentively stumbled upon, that yields a diagram that is both logically stimulating & aesthetically captivating.
Approaching the nature of primes in a more logical & traditional manner, it’s actually reasonable to expect patterns in these visualizations. As noted above, lines, in diagonal, horizontal, & vertical directions seem to contain a clue. A few of these lines that aren’t primes can be explained by simple quadratic polynomials that inherently exclude primes — for example, one of the diagonal lines will represent y = x² which clearly excludes primes. On the other side, a handful of quadratic polynomials, known as Prime Formulas (we’ll be seeing these again), are known to produce a high density of primes, such as Euler’s prime-generating polynomial: x²- x - 41, another line that appears as a pattern in the spiral (thought it’s hard to identify & non-continuous in the diagram above).
Visual comparison hints at patterns, while a logical walk-through confirms the existence of expected patterns through mapping out primes. Again, a far-cry from the universal formula for finding all primes, but the Ulam Spiral is undeniably beautiful as both a marker of knowledge & a piece of natural art.
Like many topics in math, the moment an original idea arrives, a trailing army of colleagues follow to take their crack at contributing to a burgeoning field. Reasonably, the Ulam Spiral inspired generations of mathematicians that sought to build on-top of it’s fascinating findings. In 1994 one Robert Sacks, a software engineer by trade, aimed at leveraging his programming skills to visualize primes in different ways.
Much like the Ulam spiral, Sacks decided to structure his diagram using another spiral plane. Similarly to the square-spiral above, spiral planes forgo a traditional, Cartesian number system to identify a point since it is a unipolar positioning system. Simply knowing the number reveals its location in the spiral, its position relative to every other number in the spiral, & its distance from the previous & the next perfect square. Instead of a square-spiral, however, Sacks attempted to find patterns with integers plotted on an Archimedean Spiral with the following polar coordinates:
In this method, an Archimedean spiral is centered on zero with the squares of all natural numbers (1,4,9,16,25) plotted on the intersections of the spiral & the polar axis (directly East of the origin).
From this setup, we then fill in the points between squares along the spiral (counterclockwise), drawing them equidistant from one another. Finally, like the Ulam example above, we highlight the primes contained within the resultant spiral.
First published online in 2003, the Sacks Number Spiral is both visually arresting & intellectually compelling. Additionally, as we’ll demonstrate shortly, it also yields deeper insights into prime number patterns than the well-known Ulam spiral because, in effect, it joins together the broken lines of Ulam’s pseudo-spiral:
The resultant diagram once again highlights obvious patterns. Almost immediately, it’s clear that there is a purely white line originating from the center & stretching horizontally to the east. Referring back to our setup, we can confirm that this is simply the line that contains all the perfect squares (r = n^(.5)). The second observation that jumps out is that the pattern of markings, in contrast to the straight lines seen in the Ulam Spiral, appear this time to more appropriately mimic curved lines. As it turns out, these curved lines, also known as product curves, circle back to the polynomial intuition explaining the patterns that emerged in the previous spiral. Before we jump into those, however, let’s take a quick second, for consistency, to compare the Sack’s Spiral against a randomly-plotted spiral
Robert Sacks’ work following his initial finding focused extensively on these product curves, lines that originate from the spiral’s center, or near to it & traverse the spiral’s arms at varying angles. Curves are almost straight but, more typically, they perform partial, complete, or multiple clockwise revolutions — counter to the spiral itself — around the origin before straightening out at a particular offset from the east-west axis. One of the most striking aspects of the Sacks Number Spiral is the predominance of these product curves on the western hemisphere (opposing side from the perfect squares).
Sacks describes product curves as representing “products of factors with a fixed difference between them.” In other words, every curve can be represented by a quadratic equation (a second-degree polynomial) which, again, is no mere coincidence given the primacy of the perfect square in the structure of the Sacks spiral. Arguably, these product curves lend to the observation that the Sacks spiral is significantly more useful in our journey towards understanding primes than the Ulam spiral. While the original Ulam spiral hinted at patterns & possible equations, the Sacks spiral neatly provides starting points for prime formulas — their curvature & continuity is crystallized, & therefore, they’re much more readily identifiable. For example, the Sacks spiral below contains highlighted lines with their associated Prime Formula notated in standard form. As promised, Euler’s famous prime-generating quadratic formula returns as is shown below (lowest annotation: n² + n +41):
With his number spiral, Sacks is able to make the striking assertion that a prime number is: a positive integer that lies on only one product curve. Since the spiral can be extended outward infinitely, the product curves themselves may be considered infinite; theoretically, these product curves could possibly predict the prime placement of fairly large numbers — at the very least, they’re worthy of further introspection.
In general, it’s conclusive that the Sacks spiral nudges us towards a deeper understanding of primes through more readily-identifying Prime Formulas.
We’ve now analyzed both the Ulam Spiral & the Sacks Spiral. Through both examples our understanding of the nature behind prime numbers expanded. The Sacks Spiral, specifically, introduced us to product curves, which are essentially the set of quadratic equations known as prime formulas. Both diagrams, Ulam & Sacks, are unexpected, aesthetic diagrams that soothe our curiosity & shine a light on a universally-challenging problem.
So what’s the lesson to take away from here?
To never shy away from re-framing seemingly-impossible problems, even if simply out of curiosity & boredom; breakthroughs don’t discriminate & often reveal themselves through the most unexpected efforts. By shifting perspectives on a famous problem through visualization, Stanislaw Ulam brought us all one step closer to understanding prime numbers: who knows how many other unexpected discoveries we’ll stumble across?