Main Page | See live article | Alphabetical index

# Ulam spiral

The Ulam spiral, or prime spiral (in other languages also called Ulam cloth) is a simple method of graphing the prime numbers that reveals a pattern which has never been fully explained. It was discovered by the mathematician Stanislaw Marcin Ulam in 1963, while doodling on scratch paper at a scientific meeting. Ulam, bored that day, wrote down a regular grid of numbers, starting with 1 at the center, and spiraling out like this:

```  37--36--35--34--33--32--31
|                       |
38  17--16--15--14--13  30
|   |               |   |
39  18   5-- 4-- 3  12  29
|   |   |       |   |   |
40  19   6   1-- 2  11  28
|   |   |           |   |
41  20   7-- 8-- 9--10  27
|   |                   |
42  21--22--23--24--25--26
|
43--44--45--46--47--48--49...
```
He then circled all of the prime numbers and he got the following picture:

```  37--  --  --  --  --  --31
|                       |
17--  --  --  --13
|   |               |   |
5--  -- 3      29
|   |   |       |   |   |
19        -- 2  11
|   |   |           |   |
7--  --  --
41   |                   |
--  --23--  --  --
|
43--  --  --  --47--  --  ...
```
To his surprise, the circled numbers tended to line up along diagonal lines. The following image illustrates this. This is a 200×200 Ulam spiral, where primes are black. Black diagonal lines are clearly visible.

It appears that there are diagonal lines no matter how many numbers are plotted. This seems to remain true, even if the starting number at the center is much larger than 1. This implies that there are many integer constants b and c such that the function:

f(n) = 4 n2 + b n + c

generates an unexpectedly-large number of primes as n counts up {1, 2, 3, ...}. This was so significant, that the Ulam spiral appeared on the cover of Scientific American in March 1964.

At sufficient distance from the centre, horizontal and vertical lines are also clearly visible.