August 23rd, 2013, 07:12 AM  #1 
Newbie Joined: Aug 2013 From: Netherlands Posts: 7 Thanks: 0  Primes map generator
Hopefully I'm posting this in the right (sub)forum as it overlaps with a few other categories.  Anyway, a week ago, after I had watched yet another Numberphile video, I came with the idea to write an algorithm that would create a visual representation, some sort of map, that is, of prime numbers. Currently, this project is capable of quickly generating simple grids, Ulam spirals and even Sacks spirals, while also realtime updating the map to highlight prime ktuples, and when hovering over a number several pieces of information will be shown, such as its prime factors. I didn't post this to hear from random people "Wow, awesome.". I'd rather hear your comments on what you think could be better, or maybe even functions I've missed, like another type of spiral or a piece of information that could be displayed with a number. The tool can be found here, and it's written in JavaScript (with jQuery). When trying it out, I'd recommend not going any higher than 20.000, while 50.000 and even 100.000 are still doable (but take longer), and even higher has not been tested by me yet. The drawing of a grid and an Ulam spiral take about evenly long, a Sacks spiral takes longer.  Tl;dr: What do you think of this tool I wrote? 
August 23rd, 2013, 02:38 PM  #2 
Global Moderator Joined: Nov 2006 From: UTC 5 Posts: 16,046 Thanks: 937 Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms  Re: Primes map generator
Neat. I haven't looked through the code yet; does it update the primes individually or just once for each sieving prime?

August 24th, 2013, 11:53 AM  #3 
Newbie Joined: Aug 2013 From: Netherlands Posts: 7 Thanks: 0  Re: Primes map generator
It first draws all the squares and gives every one of them the 'prime' class and colours. Once it has done that, it checks for every single number whether it is a prime, and then it changes the class and colours to 'composite'. Try a range of 1 to 20.000 or even to 50.000, and you can clearly see the process of sieving. The sieving function is called 'sieve', in case you'd decide to take a look. 
August 24th, 2013, 03:12 PM  #4 
Math Team Joined: Apr 2010 Posts: 2,778 Thanks: 361  Re: Primes map generator
Did you watch this video? I like the tool as it is but perhaps if you want to add functions to it you might want to consider to add a function that draws the lines with more primes than generally or one that shows the sieving more slowly, by some delay between two checks. 
August 24th, 2013, 04:29 PM  #5  
Newbie Joined: Aug 2013 From: Netherlands Posts: 7 Thanks: 0  Re: Primes map generator Quote:
 Quote:
 
August 25th, 2013, 03:13 AM  #6  
Math Team Joined: Apr 2010 Posts: 2,778 Thanks: 361  Re: Primes map generator Quote:
Quote:
, for example only shown when a particular style is selected. Options for delay perhaps in Standard? More space there, even after data are shown, and it applies to all Map Styles. Quote:
 
August 25th, 2013, 03:55 AM  #7  
Newbie Joined: Aug 2013 From: Netherlands Posts: 7 Thanks: 0  Re: Primes map generator Quote:
So you'd propose marking the primes with perhaps another colour if it's on a certain line? If that's the case, I could either choose for a few set lines from which the user can choose, or I could write a whole interpreter to turn the entered string into an equation. However, I've never really written an interpreter before, except for the extremely simple interpreter that reads the custom prime ktuple. Quote:
Quote:
 
August 25th, 2013, 07:46 AM  #8  
Math Team Joined: Apr 2010 Posts: 2,778 Thanks: 361  Re: Primes map generator Quote:
Quote:
Quote:
3, 7, 13 all have differences of the form p, p + 2, p + 6; 7  3 = p = 4, 13  7 = p + 2, 13  3 = p + 6. If p must be prime then 7, 11, 13. The word difference confused me there but I get it with your explanation.  
August 25th, 2013, 08:01 AM  #9  
Newbie Joined: Aug 2013 From: Netherlands Posts: 7 Thanks: 0  Re: Primes map generator Quote:
Quote:
I think I'll put a small button inside the progress bar that says "next" to go to the next factor. But currently I'm playing Skyrim. :P  
August 28th, 2013, 02:27 AM  #10 
Math Team Joined: Apr 2010 Posts: 2,778 Thanks: 361  Re: Primes map generator
I've been a bit busy too last days, other things around here and the beach and the like. The numbers on the lines, at least from bottom left to upper right seem to lie on one or two quadratics, ax^2+bx+c. The diagonal has 1, the others 2. They seem pretty similar, having a = 4. I haven't found them all though, didn't try. Are you still working on this?


Tags 
generator, map, primes 
Search tags for this page 
Click on a term to search for related topics.

Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
primes and twin primes: Number between powers of 10  caters  Number Theory  67  March 19th, 2014 04:32 PM 
Linear congruential generator  ungeheuer  Algebra  4  November 13th, 2013 09:41 AM 
Function Generator  krausebj0  Number Theory  1  June 22nd, 2013 01:42 AM 
How to prove that 3 is a generator of Zp, p = 17?  asoracc  Abstract Algebra  2  February 27th, 2011 07:03 PM 
Combination generator  jhoffma4  Advanced Statistics  0  September 11th, 2009 06:22 PM 