#
The Ulam Spiral and its generalizations

####

Jean-François COLONNA

####
jean-francois.colonna@polytechnique.edu

CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641, Ecole Polytechnique, CNRS, 91128 Palaiseau Cedex, France

[**Site Map, Help and Search [***Plan du Site, Aide et Recherche*]]

[**The Y2K bug [***Le bug de l'an 2000*]]

[**Do you believe that Real Numbers exist for a computer and that floating point computations are safe?**]

[**Please, visit ***A Virtual Space-Time Travel Machine*, the place where you can find thousands of pictures and animations between Art and Science]

(CMAP28 WWW site: this page was created on 04/25/2012 and last updated on 04/13/2019 14:17:02 -CEST-)

**[en français/in french]**

**Abstract**: What is the Ulam Spiral and how can it be extended?

**Keywords**: Ulam Spiral, Spirale d'Ulam, Prime Numbers, Nombres Premiers.

**Contents of this page:**

#
1-DEFINITION OF THE ULAM SPIRAL:

In 1963 the mathematician Stanislas Ulam had the idea to draw a "square spiral" on a squared sheet of paper.
Starting from the center, he numbered (**N**=1, 2, 3, 4,...) each of its integer points encountered as follows:

5----4----3
| | .
| | .
6 1----2 .
| |
| |
7----8----9----10

and then he marked ("X") each point whose number N was a prime number (2, 3, 5, 7,...):
X----4----X
| | .
| | .
6 1----X .
| |
| |
X----8----9----10

(1 being not a prime number). This process can be programmed in a computer; it gives birth to numerous pictures and for example the following one
that displays 2025 numbers (including 306 prime numbers):

where the green square denotes 1 and the white ones the prime numbers.
This picture exhibits the fact that prime numbers are not distributed randomly for some bidimensional patterns appear.
The structures reveal us polynoms of the second degree and for example the Euler formula:
2
f(n) = n - n + 41

n E [1,40]

that gives prime numbers for all values of n between 1 and 40.

It is interesting to compare the Ulam spiral to a random picture with the same percentage (15%) of white squares:

Here are four pictures displaying the 'P-twin' prime numbers (set of two prime numbers {P1,P2}
such that on the one hand P2-P1=P [P being an even number] and that on the other hand there are no prime number between P1 and P2):

#
2-SOME GENERALIZATIONS:

In the 1980's, I had the idea to generalize this process displaying **ND** (the number of divisors of N;
let's recall that prime numbers have only two divisors: 1 and themselves).
Hence the following picture displaying 2025 numbers:

where the green square denotes 1 and the white ones the prime numbers,
when the red squares display the other numbers, their luminance being
porportionnal to ND.

The two following pictures display respectively 100 and 1000 numbers by means of a different visualization
code. ND is shown simutaneously using the radius of each sphere as well as the increasing luminance
of colors:

Moreover, there are many other ways to exhibit these informations. For example, ND
can be displayed using a third dimension:

At last, other types of spiral can be used and for example the Archimedes one:

#
3-ULAM SPIRAL AND ARTISTIC CREATION:

The Ulam spiral and the prime numbers can be a source of artistic inspiration as exhibited with the following pictures:

by means of various processes: conformal transformations, filtering, extended life game,...
that allow deformations, transformations, smoothings,... of the Ulam spiral and of some of its generalizations.

####
Copyright (c) Jean-François Colonna, 2012-2019.

Copyright (c) CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / Ecole Polytechnique, 2012-2019.