Skip to content
Primes visualized over an Ulam Spiral in HTML5
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Twin primes visualized over an Ulam Spiral

Two numbers p and q are twin primes if they are primes and |p – q | = 2.

The Ulam spiral, discovered by the mathematician Stanislaw Ulam in 1963, is a simple method to visualization prime numbers. Put the numbers in a spiral and draw only the ones which are primes.

In the visualization below, I’m drawing the prime numbers in two shades of green. Twin primes in light green and regular primes in dark green.

twin primes ulam spiral

This “vortex effect” is created because every twin prime is followed by its twin two steps before in the spiral. Below the same image with the zoom in the center:

twin primes ulam spiral

The Prime Conspiracy

See details at

conspiracy ulam spiral

in HTML5

[](HTML5 demo with Canvas + Javacript). Be aware that this page can be computational intensive and freeze your browser for a few seconds.

try it yourself

git clone

And open the html files in a modern browser.

This content was posted originally on my personal blog.

You can’t perform that action at this time.