The prime numbers have presented mathematicians with some of their most challenging problems. They continue to play a central role in number theory, and many key questions remain unsolved.

** Order and Chaos **

The primes have many intriguing properties. In his article “The first 50 million prime numbers”, Don Zagier noted two contradictory characteristics of the distribution of prime numbers. The first is the erratic and seemingly chaotic way in which the primes “grow like weeds among the natural numbers”. The second is that, when they are viewed in the large, they exhibit “stunning regularity”.

Many people have sought patterns in the prime numbers, and there has been much progress. But we still do not hold a key that unlocks all their secrets.

** Ulam’s Spiral **

In 1963, Stanslaw Ulam arranged the natural numbers in a spiral pattern, and discovered that many of the prime numbers occurred along particular diagonal lines. Ulam’s spiral pattern was popularized by Martin Gardner in his *Mathematical Games* column in Scientific American. According to Gardner, Ulam discovered the pattern while attending a boring lecture during a scientific meeting. The figure below shows the method of construction devised by Ulam (left) and a spiral of size with prime numbers marked. Several diagonal lines with a high density of primes are clearly visible.

which is prime for all whole numbers from to . These primes show up in the Ulam spiral, but they are split into two diagonals on opposite sides of the origin.

** Improving on Ulam’s Spiral **

A clever variation on Ulam’s spiral was found in 1994 by software engineer Robert Sacks. He plotted the natural numbers on an Archimedean spiral, with the following equations in polar coordinates:

Thus, which yields a spiral with radial distance increasing by a fixed amount for each circuit of the origin. And the square roots ensure that the azimuthal angle is an exact multiple of for all square numbers .

The pattern for the first 100 numbers is shown below (left panel). The underlying Archimedean spiral is also shown. Perfect squares, coloured red, occur on the positive -axis. The numbers coloured magenta are *pronic numbers*, that is, numbers of the form . These are also arrranged in a quasi(?)-linear pattern.

The right-hand panel shows the same spiral, but with the prime numbers coloured blue. The pattern is not immediately obvious, but it is clear that the primes are not arranged in random order: there is evidence of some definite structure.

The following figure shows primes from 2 to 50,000 marked in blue. We see a number of curved lines along which many primes are arranged. The spiral in red is for prime numbers of the form , Euler’s polynomial. We can see how densely primes occur on this curve.

** Composite Numbers **

The interest of Sacks’s spiral is not confined to prime numbers. It also reveals patterns amongst the composite numbers. The -function is a measure of the extent to which a number is composite: is the number of prime factors of , with multiplicities counted. Obviously, for each prime number. Also, for the -th power of a prime we have . For another example, so that .

The figure below shows the spiral for with the dot-size (and colour) of point scaled in proportion to . It shows a wealth of structures, with families of curves corresponding to sets of numbers with the same degree of compositeness.

There is much more that can be said about the Sacks spiral. Additional information and explanations can be found on the web-site of the inventor, Robert Sacks (URL below).

** Sources **

Robert Sacks’s website on the number spiral .

Wikipedia article *Ulam Spiral* .

Zagier, Don, 1977: The first 50 million prime numbers. *The Mathematical Intelligencer*, **1**, 7–19.