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 real-time updating the map to highlight prime k-tuples, 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.

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.

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.

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.

Sounds like a neat idea, and not even hard to implement (could be done in a day or so). I could even add buttons to go to the next step of sieving, though the biggest problem with that is that I think the menu is already quite full of stuff, so I wouldn't know where to place them

Sounds like a neat idea, and not even hard to implement (could be done in a day or so). I could even add buttons to go to the next step of sieving, though the biggest problem with that is that I think the menu is already quite full of stuff, so I wouldn't know where to place them

Maybe you could put the options for the lines next to the choice for the mapstyle, like, 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:

Originally Posted by your site

A prime triplet is a set of three primes of which the difference is p, then p + 2 or p + 4 and then p + 6.

I believe that is not what you want. A prime triplet is a set of three primes p, p + 2 or p + 4, p + 6. Or are you indicating the lines from the video?

Sounds like a neat idea, and not even hard to implement (could be done in a day or so). I could even add buttons to go to the next step of sieving, though the biggest problem with that is that I think the menu is already quite full of stuff, so I wouldn't know where to place them

Maybe you could put the options for the lines next to the choice for the mapstyle, like
(image), for example only shown when a particular style is selected.

Whoops, I actually read over the part where you spoke of those lines and just read the part about the delay. But I indeed do know of those lines.
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 k-tuple.

Quote:

Originally Posted by Hoempa

Options for delay perhaps in Standard? More space there, even after data are shown, and it applies to all Map Styles.

Let me think. I'll need a button to toggle the delay, and maybe somewhere the delay should be set? How about putting the toggle under standard, and the delay itself under advanced settings?

Quote:

Originally Posted by Hoempa

Quote:

Originally Posted by your site

A prime triplet is a set of three primes of which the difference is p, then p + 2 or p + 4 and then p + 6.

I believe that is not what you want. A prime triplet is a set of three primes p, p + 2 or p + 4, p + 6. Or are you indicating the lines from the video?

With a prime triplet I meant that there are two possibilities: it is either of the form (p, p + 2, p + 6) or of the form (p, p + 4, p + 6). You should read the explanation on my site as that a prime triplet is of the form (p, (p + 2 or p + 4), p + 6).

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 k-tuple.

Do you want such an interpreter? Personally, I'd try to minimize required users input. Sure, you can change things the way you want but if you don't change anything and press start, then you still get such a graph for settings you, the programmer choose. You could check all these lines, find that on average ther are, say 4% prime. Some lines contain over 10% primes for which the primes could be marked than. This doesn't require user-input at all but if you want some, you could have user change percentages or so. I think that would be easier to interpret.

Quote:

Originally Posted by Waflix

Let me think. I'll need a button to toggle the delay, and maybe somewhere the delay should be set? How about putting the toggle under standard, and the delay itself under advanced settings?

Yes, I like the idea, also where you place the options. Do you drop buttons to go to the next step of sieving? I just want to share ideas, not really tell you what to do.

Quote:

Originally Posted by Waflix

With a prime triplet I meant that there are two possibilities: it is either of the form (p, p + 2, p + 6) or of the form (p, p + 4, p + 6). You should read the explanation on my site as that a prime triplet is of the form (p, (p + 2 or p + 4), p + 6).

Ah, I see what you mean. I read it like such a triplet could be 5, 7, 11, 19. They have differences of the form p, p + 2, p + 6 where p = 2, but that's four primes instead of three but three differences. p itself needn't be prime, it's just (a term from) the differences. p = 4 gives 3, 7, 13, 23 as an option. But we want just 3 primes.
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.

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 k-tuple.

Do you want such an interpreter? Personally, I'd try to minimize required users input. Sure, you can change things the way you want but if you don't change anything and press start, then you still get such a graph for settings you, the programmer choose. You could check all these lines, find that on average ther are, say 4% prime. Some lines contain over 10% primes for which the primes could be marked than. This doesn't require user-input at all but if you want some, you could have user change percentages or so. I think that would be easier to interpret.

The formula for the amount of lines that can be drawn is 2 + 4(n - 1), where n is the width/height (whichever is higher) of the spiral. Would I be to draw a 200 by 200 grid, I'd have 798 lines to draw. To draw a line, I need to create a formula for that specific line (which I need to automate, so like a general formula that creates formulae), and then count the total amount of primes on that line. I think the hardest part mathematically is finding that general formula, and after I've managed that I'll also have to see whether the amount of calculations (and their severity) is even reasonable.

Quote:

Originally Posted by Waflix

Let me think. I'll need a button to toggle the delay, and maybe somewhere the delay should be set? How about putting the toggle under standard, and the delay itself under advanced settings?

Yes, I like the idea, also where you place the options. Do you drop buttons to go to the next step of sieving? I just want to share ideas, not really tell you what to do.[/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

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?