Hacker News new | past | comments | ask | show | jobs | submit login
Prime Number Patterns (jasondavies.com)
122 points by sebg on July 7, 2015 | hide | past | favorite | 17 comments



See also divisor plot: http://www.divisorplot.com/

This guy plotted the table of numbers and their divisors and found lots of patterns in it.


Seriously, thank you for posting that! I enjoyed his site immensely and will definitely revisit it in the future.


I concur, his site is amazing, he's definitely on to something, great abstractions there and relations to factorials. Love it.


> The prime numbers are those that have been intersected by only two curves: the prime number itself and one.

This is merely a prettier but somewhat obfuscated Sieve of Eratosthenes: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes


It's a richer visualization than that. The Sieve of Eratosthenes only marks which numbers are composite -- this visualization actually shows each of the factors.



"Merely" is a word that makes me imagine what might have been if only.


For all the time and energy already devoted to studying prime numbers, it's amazing how we keep finding compelling new things to say about the subject.

I agree this presentation shows considerable grace and beauty, quite effective at showing the numeric relationships among positive integers in an intuitive clear way. As the scale varies, the "zoom" feature very nicely allows the viewer to appreciate the fractal nature of the numerical order. Educational and fun, it's a creative success.

Just yesterday on HN there was a thread concerning favored books, mentioning "Proofs Without Words", which this site reminds me of. Where it works it is a wonderful concept, and here it works well.


This is beautiful! Not just is it really quite cool to explore with, but is truly gorgeous. It is true as another user put that this is a graphical way of looking at a sieve of Eratosthenes, but to say that it is is “only” suggests to me a lack of appreciation for the beauty (plus, it also maps other non-prime patterns: deficient, perfect and abundant).


Not sure if it's mathematically related to the OP patterns, but the prime number patterns apparent in the Ulam Spiral have always been my favorite example of this:

https://en.wikipedia.org/wiki/Ulam_spiral


1/2 (6 n-cos(pi n)+3)

This can be expanded into a prime sieve that shows what he has here.

  #prime.pl

  use Math::Complex;
  use Math::Trig;
  use POSIX;
  # P = A = 1/2 B (6 n-cos(pi n)+3) \ B = 1/2 (6 n-cos(pi n)+3)

  my $pi = pi;

  my @k;
  my $count = "100";
  my $n = "1";
  my @c;

  ### given two sets A, B returns B \ A (ie all elements that are in B but NOT in A)
  sub complement
  {
      my @set1 = @c;
      my @set2 = @k;
      my @ans=();    

      ## find intersection of A and B
      my @intersection=(@set1);

      for(my $i=0;$i<@set2;$i++)
      {
         for(my $j=0;$j<@intersection;$j++)
         {
            if($set2[$i] eq $intersection[$j])
            {
               $set2[$i]="?";
            }
         }
      }

      for(my $i=0;$i<@set2;$i++)
      {
         push(@ans,$set2[$i]) if $set2[$i]!~m/\?/;
      }
      return @ans;
  }

  for ($count = 100000 ;$count >= $n; $n++){
  	my $k = ((3 * $n) - (0.5 * cos($pi*$n))) + 1.5;
  	push (@k, $k);
  }

  my $c; 
  my $x = $#k;
  my $y = $k[$x];

  foreach (@k){
  	my $b = $_;
  	my $n = "1";
  	$c=1;
  	next if ($b >= floor(sqrt($y + 1)));
  	for ($count = $y + 1 ;$count >= $c; $n++){
  		$c = (((3 * $n) - (0.5 * cos($pi*$n))) + 1.5) * $b;
  		next unless ($c <= $y + 1);
  		push (@c, $c);
  	}
  }

  print "stophere";

  %hashTemp = map { $_ => 1 } @c;
  @c = keys %hashTemp;
  @c = sort { $a <=> $b } @c;

  #@P = &complement;

  print "stophere";


If n=8, then this function equals 25. Am I missing something?


Yeah, its a sieve, this block:

  foreach (@k){
  	my $b = $_;
  	my $n = "1";
  	$c=1;
  	next if ($b >= floor(sqrt($y + 1)));
  	for ($count = $y + 1 ;$count >= $c; $n++){
  		$c = (((3 * $n) - (0.5 * cos($pi*$n))) + 1.5) * $b;
  		next unless ($c <= $y + 1);
  		push (@c, $c);
  	}
  }
Allows you to iterate of the next set and find the none prime and remove them from the SET of 1/2 (6 n-cos(pi n)+3) Thats how a sieve works. 1/2 (6 n-cos(pi n)+3) is only good up to n^2 then you need to multiply 1/2 (6 n-cos(pi n)+3) by i as you noted the first non-prime result was @ 5^2 therefore you need to sieve the rest of the numbers up to 7^2 by doing (1/2 (6 n-cos(pi n)+3)) * 5 Then after 7^2 seive off with (1/2 (6 n-cos(pi n)+3)) * 7 you continue to repeat this for all numbers in the original set. See the sieve of eratosthenes. Mine though shows primes as a set of sin waves kind of like what the op has. As a matter of fact the post is basically a visual representation of what I coded above.


I've just never plotted the data.


I'm seeing patterns in the factoring of non-prime integers, but nothing to highlight any patterns that exist among prime numbers.


absolutely stunning design. nothing of new mathematical interest. beautiful though - simply gorgeous.


72 is so pretty




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: