Investigating Primes: Variations in Ulam Spirals
Introduction
“Out of an infinity of designs a mathematician chooses one pattern for beauty’s sake and pulls it down to earth.” - Marston Morse, American Mathematician
This project is an introduction to prime numbers (don’t worry, we define these soon!) through a rather artistic lens; instead of jumping straight into algebraic work, we look at numbers via the patterns they make in \(2\)-dimensional space. We start by considering Ulam spirals initially, and then branch specifics such as Archimedean spirals, and from there we branch further into prime spirals and visualizations of Gaussian and Eisenstein primes (once again, all of this will be defined shortly).
The visualizations made in this project are via Python, and all code used will be provided inline with the project, and so if you wish to play around with the code and parameter sizes on your own machine, you can easily do so!
Mathematical Background
To avoid overwhelming the layman, we introduce each mathematical concept quite carefully.
What are prime numbers?
To consider this idea of prime numbers, we first need to consider what “natural numbers” are, as primes build off of the naturals. A natural number is a positive whole number (a number with no decimal or fractional part); namely our set of naturals is the set \(\mathbb{N} = \{0, 1, 2, 3, ...\}\), where these numbers continue on to infinity (where \(\mathbb{N}\) denotes the natural numbers)1.
So we have defined the naturals, but the question remains: what are primes? Prime numbers are essentially all naturals greater than \(1\) such that it is not a product of two smaller naturals, i.e the only things that can multiply to equal our prime are the prime itself and the number \(1\), these are the only two factors of the prime number! Examples of prime numbers include \(2, 3, 5, 7, 11, ...\), and there are infinitely many prime numbers 2, so this list of primes continues on to infinity.
What are Ulam spirals?
We know now what the prime numbers are, and we can write them as a set as such, \(P = \{2, 3, 5, 7, 11, ...\}\), where \(P\) is just our denotation for the set of prime numbers. But, instead of writing these numbers as a set (boring!), what if we write them graphically?
-
Note that some people may exclude \(0\) from the set of naturals … for our purposes we leave this discussion entirely, if you’re interested take a look at this. ↩
-
People may ask why there are infinitely many primes … we won’t prove it here, but there is a famous proof for why there are infinitely many primes - take a look at Euclid’s famous proof of infinite primes here. ↩