Even moments of boredom can lead to fascinating discoveries when you are a genius. In 1963, mathematician Stanisław Ulam was at a scientific conference and started doodling on paper. He arranged the integers in a spiral, then began marking the prime numbers. He discovered a series of regular patterns along diagonals that became the cover story of Scientific American the following year. The Ulam spiral is something that still keeps specialists busy today.

The Ulam Spiral
The Ulam spiral still keeps specialists busy to this day.

A Quick Look at Prime Numbers

Mathematicians say a natural number is “prime” when it has exactly two distinct natural divisors: itself and 1. These numbers have intrigued mathematicians for centuries, and to this day there is no formula that generates the entire series of primes. We know they are infinite, and they form an important part of number theory. Prime numbers are part of some centuries-old works, such as the Riemann hypothesis and the Goldbach conjecture, and the difficulty of determining the prime factors of a large number — one with hundreds or thousands of digits — has made them the ideal key for many cryptography systems.

The first prime number is 2. It is followed by 3, 5, 7, 11, 13, 17, etc. The distribution of prime numbers on the “line” of natural numbers seems completely random, although, logically, the fact that they can only be divided by themselves and 1 means this distribution is not, strictly speaking, completely random. Many mathematicians (probably all) are strongly attracted to these numbers.

Ulam's Boring Conference Discovery

One of them was Polish-American Stanisław Marcin Ulam, who made a very interesting discovery in 1963. Ulam had attended a scientific conference whose content was absolutely boring. He had paper and pencil, so he began to doodle, as any of us might do while on the phone or, like Ulam, thinking about anything. But unlike mere mortals, Stanisław was a born mathematician, so instead of stick figures or hearts, he drew numbers. With no preconceived plan, he wrote the integers along a spiral, as seen in the following image:

The Ulam Spiral
Ulam arranged the integers on a spiral.

After drawing a few turns of numbers, and seeing that the conference continued on its course without touching any topic of interest, he began marking the prime numbers. He marked 2, then 3, 5, and so on, until after marking a few dozen numbers, he found a pattern like the following:

The Ulam Spiral
And then he marked the numbers that were prime.

He quickly noticed that the numbers that remained on the spiral — the “primes” — grouped along diagonal patterns. Although it was still difficult to predict where the next prime would “fall,” the appearance of the resulting graph was clearly something very different from a random distribution. It is easy to see that the numbers cluster in diagonal lines of different lengths. Since all primes (except 2) are odd, and in the Ulam spiral some diagonals contain odd numbers and others even, prime numbers fall on alternating diagonals. Given their irregular nature, these diagonals contain different proportions of prime numbers.

The Ulam Spiral
The resulting graph is very attractive.

Computer-Generated Spirals

Using computers, “Ulam spirals” of enormous sizes have been plotted. Invariably, no matter how large the spiral gets, the mentioned diagonals continue to appear. This happens even when the central number is not one. In fact, any number can be used as the start of the spiral and the result is always similar. Naturally, spirals generated with different starting numbers are not identical, but they always show those diagonals.

Legacy and Unresolved Questions

The “work” Ulam did while bored at that conference quickly became famous among his colleagues. So much so that the cover of the renowned magazine Scientific American in March 1964 featured this spiral as its main article. Nevertheless, Ulam's contribution has not yet led to any revolutionary application of prime numbers or to a faster way to factor a number. However, specialists have not given up hope that one day this spiral will shed light on the nature of these intriguing numbers.

The Ulam Spiral
The Ulam spiral

For more information, see the entry for the Ulam spiral on Wikipedia.