The Ulam spiral is a graphical layout of prime numbers,
credited to the Polish/American mathematician Stanislav Ulam
who discovered it in 1963.
Start at the center of a flat, two-dimensional surface; e.g., a sheet of paper or a computer screen,
with the number 1. Next, form an outward spiral using one step for each next whole number (in Figure 2 we go
counter-clockwise) and highlight the prime numbers.
What will you see?
the result is the
Ulam spiral of primes (see also Figure 1).
In Figure 1 it is pretty much impossible to see a spiral pattern especially since we do not see
the actual numbers displayed with their values, What we do see, however, is
that although the distribution of prime numbers on smaller scales is unpredictable,
the pattern in the Ulam spiral shows quasi-regular patterns of straight lines of primes.
When laid out in polar coordinates with a rotation of 1 radian
between numbers (Figure 2) —refer to the start of
this video for a nice explanation of
polar coordinates— the results is several distinct
Archimedean spirals of primes.
We would more or less expect these 'spiral' arms for numbers in general because of the way we have
laid them out; i.e., subsequent numbers are rotated 1 radian and one full rotation = 2π ≈
6 radian. Hence, the difference of 6 between numbers on the spiral arms. But again, given the unpredictability
of primes, it is interesting to see them showing up in spirals as well.
You can play with this below.
Zoom factor:
Figure 1: Ulam spiral of primes (primes are shown as red dots; non-primes are not shown)