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:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#!/usr/bin/env perl # gaps-simple: Print the gaps between primes use strict; use warnings; use Math::Prime::XS qw(primes); my $limit = shift || 100; my @primes = primes($limit); my $n = 0; while ( $n < @primes - 1 ) { my $prime = $primes[$n]; my $greater = $primes[ $n + 1 ]; my $gap = $greater - $prime; print "$gap\n"; $n++; } |

This […]