The Density Plot of the Prime Gaps is a Fractal

tl;dr: Inspect the last image below and check out gap-density.R.

I just discovered something that made me smile: As I looked at the density plots of increasing numbers of prime gaps, a fractal emerged.

Allow me to explain.

First I get the prime gaps (basically, the distance between primes) with this perl code:

This returns a list like this:

Then, I say, “perl gaps-simple 10 > gaps-simple-10.txt” to get all the prime gaps below the number 10 into a text file.

Next I inspect this in R (the statistical programming environment – r-project.org), as such:

For increasing numbers of gaps (shown to 100_000_000), this results in the following graphs.  You can see the self-similar, fractal nature emerge:

gaps-simple-10gaps-simple-100gaps-simple-1_000gaps-simple-10_000gaps-simple-100_000gaps-simple-1_000_000gaps-simple-10_000_000gaps-simple-100_000_000

Comments

*