Hyperbolic Tessellations

A tessellation refers to a uniform tiling of a plane with polygons, such that an equal number of identical polygons meet at each vertex. For example, the tiles in a bathroom, the squares of linoleum on an office floor, or the honeycomb pattern in a bees’ nest are all tessellations of the Euclidean plane.

Hyperbolic TessellationHowever, tessellations are also possible on non-Euclidean spaces, such as the elliptic plane (like the stitching pattern on a soccer ball), and the hyperbolic plane (like… nothing you’d find around the house). In fact, the Euclidean plane has only three regular tessellations (with squares, hexagons, and triangles), while the hyperbolic plane can be tessellated in infinitely many ways.

Since we do not exist in hyperbolic space, we cannot truly “see” hyperbolic tessellations. We can only “represent” them in Euclidean form. A common way of doing this is on the Poincaré disk, which is a finite circle that represents the boundary of the (infinite) hyperbolic plane that is contained inside. The image on the right is a hyperbolic tessellation drawn on the Poincaré disk.

Since tessellations of the hyperbolic plane are especially interesting and mesmerizing to look at, I wrote a small program that generates them, with a great deal of configurable options.

Tessellation Application

Using the Program

The program allows you to create an unlimited number of tessellations by selecting “File -> New” from the menu.

When viewing a tessellation, click-and-drag inside of it to shift its position within hyperbolic space. You can also click-and drag with the right mouse button to manipulate the truncation of the tessellation.

Tessellation ControlsThe “Tessellation Controls” window allows you to change the settings for the tessellation that is currently active.

  • p and q — The numbers specified by p and q refer to the Schläfli symbol {p,q} of the tessellation. The Schläfli symbol is a simple way of classifying tessellations where p is the number of sides in each polygon, and q is the number of polygons that meet at each vertex.
  • Max. Vertices — This specifies the number of vertices that will be drawn (how far the tessellation will extend towards the disk boundary). More vertices will take exponentially longer to draw. Also, with more vertices, clicking-and-dragging the tessellation will become slower. With a good screen resolution, 10000 vertices fills up the Poincaré disk almost completely.
  • Model — Select “Poincaré” to draw the tessellation on a Poincaré-style disk, and “Klein” to draw on a Klein-style disk. The Klein disk is similar to the Poincaré disk, except the Klein disk transforms hyperbolic space so that a line between two points appears as a straight line, instead of a circle arc, which is what the Poincaré disk gives.
  • Quality — Select “Low” to display simple straight lines between vertices (and let the tessellation be drawn much faster). Select “High” to draw actual curved lines between vertices. This will slow down drawing considerably.
  • Truncation — This is a list of predefined levels of truncation for the tessellation. Select from this list to apply a certain truncation. You can also do free-form truncation by clicking-and-dragging on the tessellation with the right mouse button.
  • Colors — This allows you to select different colors for each of the components of the tessellation, and to enable or disable drawing of each component.
  • Driver — This selects what functions the program will use to draw the tessellation. Select “OpenGL” to use OpenGL technology, or “Windows GDI” to use plain Windows functions. In most cases, selecting OpenGL will enable the images to be drawn considerably faster, especially with Antialiasing enabled. However, OpenGL is not supported on some (very) old graphics cards. Also, if you create multiple tessellations, only one can be drawn with OpenGL at any given time.
  • Antialias lines — Check this box to draw “smooth” lines.
  • Line Thickness — This specifies the thickness (in pixels) of the lines that make up the tessellation.
  • Advanced — These options are mostly experimental and will not be discussed here.


Here’s a brief collection of images created using this program. Click on an image to view a larger version.

{7,3} tessellations, with various truncation:
none, (0,1,0), (0,.5,.5), runcinated, omnitruncated, and snub.

No Truncation(0,1,0) Truncation(0,.5,.5) Truncationruncinatedomnitruncatedsnub


  • This program borrows a substantial amount of code from Don Hatch‘s page, which has an exhaustive gallery of {p,q} permutations and truncations, as well as a tessellation Java applet.
  • David E. Joyce’s tessellation page at Clark University.

Ulam’s Prime Number Spiral

There is an infinite number of prime numbers, and yet the prime numbers themselves do not display any apparent pattern, nor does any formula exist that generates prime numbers. In fact, Legendre proved that there cannot be an algebraic function which always gives primes.

Prime SpiralHowever, prime numbers do exhibit a curious phenomenon when arranged in a spiral along with other consecutive integers, as in the figure to the right (in the figure, prime numbers are highlighted in white, twin primes are green, and Mersenne primes are red).

The Phenomenon

It was first noticed by the physicist Stanisław Ulam in 1963, when he got bored in a meeting and started doodling spirals of numbers. He noticed that, if he makes a spiral of consecutive integers, and circles only the prime numbers, strange diagonal “lines” of prime numbers emerge.

This is quite surprising, since we would intuitively expect a random distribution of prime numbers. However, these diagonal segments occur on an impressively large scale, and arbitrarily far from the center of the spiral. The following image is a spiral containing about 4000 primes, and next to it is the same image with some of the diagonal paths highlighted.
Prime Spiral


To explore this phenomenon on a large scale, I wrote a small program that generates arbitrarily large spirals, with configurable coloring and other options.

Download the program! (Or browse the source code on GitHub)

Prime Spiral Application
The program generates a spiral based on the total number of integers that you specify. It also allows you to specify the colors to use for the background, prime numbers, twin primes, and Mersenne primes.

In addition, the program allows you to use a custom polynomial (up to degree-2) for generating the spiral. By default, the polynomial is set to
f(n) = n
so the spiral will have the normal sequence 0, 1, 2, 3, etc. However, as an example, suppose you want the spiral to consist only of odd integers (1, 3, 5, 7, etc). You can simply set the polynomial to be
f(n) = 2n + 1
Odd Prime Spiral
by writing “2” in the text box next to “n“, and “1” in the last of the three text boxes. The image to the right shows a spiral constructed from odd integers only. Notice the prominent “patterns,” this time extending vertically and horizontally.


Ultimately, all that these patterns show is that certain polynomials are more “likely” to generate prime numbers than others. In fact, we can speculate that these kinds of patterns would emerge if we arrange the integers in any ordered design, not just a spiral. Even if we arrange the integers in a simple table, we would still see occasional “streaks” of prime numbers similar to the ones seen in the spiral.

The existence of “prime-generating” polynomials was known since the time of Euler, who discovered a polynomial that gives 40 consecutive prime numbers, namely
$$f(n) = n^2 – n + 41$$
The reason why some polynomials generate more primes than others is still not known.

Extreme Spirals

Using my program, you can generate extremely large spirals, limited only by the amount of memory on your computer. Here are some fairly large ones that I generated: