Gaussian Prime Spirals

Start a loop with a point having integer coordinates in the complex plane (called a Gaussian integer) and trace a path as follows:
• Move right until a Gaussian prime is encountered, then turn left 90°.
• Continue, always moving straight in the current direction until a Gaussian prime is encountered, and again turn left 90°.
The loop ends when the path returns to , facing right.
For this Demonstration, the first point in the cycle is taken to be the first Gaussian prime to the right of the Gaussian integer nearest the locator. From that point, the path goes right and is colored red; the path eventually ends at the start, again colored red. Because the path can overlap itself, the colors can be hidden.
Drag the locator to change the starting position, but note that if the locator is outside the circle of radius 40, it is moved by radial shrinking to a Gaussian integer near that circle.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


The problem of whether all initial values lead to closed cycles was first raised in [1]. It is related to the open question: Does every horizontal line contain infinitely many Gaussian primes? This is a consequence of the far-reaching hypothesis H of Schinzel [2]. But even if the horizontal line conjecture is true, it is not clear that starting points always cycle.
Within the square bounded by ±100, the largest cycle has length 4820 and starts at . The largest cycle in a search bounded by ±500 starts at and has length 316628. The starting value leads to a walk with 3,900,404 steps.
[1] Gaussian prime spirals, MathOverflow question 91423
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.