The Ulam Spiral, discovered in 1963 by Stanislaw Ulam, is a graphical depiction of the set of prime numbers.

If you were to arrange the positive numbers in a spiral, starting with one at the centre, then circle all of the prime numbers, what would you get? As prime numbers don’t have a predictive structure, you would expect to get little or even nothing out of arranging the primes this way. But, Ulam discovered something incredible:

To his surprise, the circled numbers tended to line up along diagonal lines. In the 200×200 Ulam spiral shown above, diagonal lines are clearly visible, confirming the pattern. Although less prominent, horizontal and vertical lines can also be seen.

Even more amazing, this pattern still appears even if we don’t start with 1 at the centre!

There are many patterns on this plot. One of the simplest ones is that there are many integer constants b and c such that the function:

generates, a number of primes that is large by comparison with the proportion of primes among numbers of similar magnitude, as n counts up {1, 2, 3, …}.