/ulams-spiral

Just for fun code written to generate primes and Ulam's Spiral

Primary LanguagePython

Ulam's Spiral

Discovered by Stanislaw Ulam while doodling in a math conference in 1963, Ulam's Spiral is a way of visualizing prime numbers.

Written by Jesse Lieman-Sifry while looking for interesting projects during the Summer of 2015, ulamsSpiral.py generates prime numbers up to a user-specified number, figures out which of those are have a neighbor two away (11 and 13, for example), then plots them. A few different size outputs/configs are included in this repository.

Below is the version with all primes visualized as white pixels. Image

In this version (below), any primes that have a neighbor prime (two away) are visualized as white pixels. Lonely primes are orange pixels. Image

This version is only 25x25, helping to show the pattern at a small scale. Image