# Gaussian primes

This Web application shows a graphical view of Gaussian primes.

The Gaussian integers are complex numbers of the form `a` + `b``i` where `a` and `b` are (standard) integer numbers and `i` is the square root of -1.
Like integers, these numbers can be factored into primes in only one way (this is known as unique factorization domain).
For example: 79 + 43`i` = (1+`i`) (2-`i`) (28+5`i`)

In order to determine if a Gaussian number `x` + `i``y` is prime or not, one of these three criteria must be true:

`x`=0,`y`=3 (mod 4),`y`is prime.`y`=0,`x`=3 (mod 4),`x`is prime.`x`≠0,`y`≠0,`x`² +`y`² is prime.

This Web application shows the Gaussian primes where |`a`| < 1000000000 and |`b`| < 1000000000. The prime numbers are marked in green.

Move the graph by moving the mouse over it with the left button pressed. You can obtain more detail or see a larger area by using the Zoom buttons or the mouse wheel.

You can also see the position `a` + `b``i` in the complex plane of any point of the graph by moving the cursor to that point.

Move the center by typing a new complex number in both input boxes (up to 9 digits each) and press the return key.

There is an unsolved mathematical problem named *Gaussian moat* regarding the graphical representation of Gaussian primes. It asks whether there is a path from zero to infinity with steps of bounded size. Nobuyuki Tsuchimura shown in 2004 that it is not possible to reach the distance 80015782 from the origin if the steps have length 6 or smaller.

Written by Dario Alpern. Last updated 26 November 2021.

## Source code

You can download the source of the current program and the old Ulam spiral visualization applet from GitHub. Notice that the source code is in C language and you need the Emscripten environment in order to generate Javascript.