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.
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:
[http://silveiraneto.net/wp-content/uploads/2013/05/twin_primes_ulam_spiral.html](HTML5 demo with Canvas + Javacript). Be aware that this page can be computational intensive and freeze your browser for a few seconds.
git clone https://github.com/silveira/ulam
And open the html files in a modern browser.