The Ulam spiral or prime spiral is a graphical depiction of the set of prime numbers, constructed by writing the positive integers in a square spiral and specially marking the prime numbers.
The Ulam spiral is constructed by writing the positive integers in a spiral arrangement on a square lattice:
and then marking the prime numbers: