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.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Powered by Wolfram Mathematica © 2014 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+