# Ulam spiral

 related topics {math, number, function} {math, energy, light} {@card@, make, design} {line, north, south} {day, year, event}

The Ulam spiral, or prime spiral (in other languages also called the Ulam Cloth) is a simple method of visualizing the prime numbers that reveals the apparent tendency of certain quadratic polynomials to generate unusually large numbers of primes. It was discovered by the mathematician Stanislaw Ulam in 1963, while he was doodling during the presentation of a “long and very boring paper”[1] at a scientific meeting. Shortly afterwards, in an early application of computer graphics, Ulam with collaborators Myron Stein and Mark Wells used MANIAC II at Los Alamos Scientific Laboratory to produce pictures of the spiral for numbers up to 65,000.[2][1][3] In March of the following year, Martin Gardner wrote about the Ulam spiral in his Mathematical Games column;[1] the Ulam spiral featured on the front cover of the issue of Scientific American in which the column appeared.

Ulam constructed the spiral by writing down a regular rectangular grid of numbers, starting with 1 at the center, and spiraling out:

He then circled all of the prime numbers and he got the following picture:

To his surprise, the circled numbers tended to line up along diagonal lines. The image below is a 200×200 Ulam spiral, where primes are black. Diagonal lines are clearly visible, confirming the pattern. Horizontal and vertical lines, while less prominent, are also evident.

All prime numbers, except for the number 2, are odd numbers. Since in the Ulam spiral adjacent diagonals are alternatively odd and even numbers, it is no surprise that all prime numbers lie in alternate diagonals of the Ulam spiral. What is startling is the tendency of prime numbers to lie on some diagonals more than others.

Tests so far confirm that there are diagonal lines even when many numbers are plotted. The pattern also seems to appear even if the number at the center is not 1 (and can, in fact, be much larger than 1). This implies that there are many integer constants b and c such that the function:

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

Remarkably, in a passage from his 1956 novel The City and the Stars, author Arthur C. Clarke describes the prime spiral seven years before it was discovered by Ulam. Apparently, Clarke did not notice the pattern revealed by the Prime Spiral because he "never actually performed this thought experiment."[4]

According to Ed Pegg, Jr., the herpetologist Laurence M. Klauber proposed the use of a prime number spiral in finding prime-rich quadratic polynomials in 1932, more than thirty years prior to Ulam's discovery.[5]