Talk:Successive prime differences: Difference between revisions

Content added Content deleted
m (→‎Task background: added a comment about twin prime task.)
Line 11: Line 11:
* It's a twin prime.
* It's a twin prime.


I searched Rosetta Code and found that there was no twin prime task! (I had expected that someone would have already started it). I resolved to wait untill closer to my birthday then put up a twin primes task and left it at that.
I searched Rosetta Code and found that there was no twin prime task! (I had expected that someone would have already started it). I resolved to wait until closer to my birthday then put up a twin primes task and left it at that.


A few days later I started to think of what a generalisation around the idea of twin primes would be and hit on a difference; then multiple differences; then really liked how my solution to generating a sliding group of <nowiki><count></nowiki> items from a list actually did come from the Python fundamentals:
A few days later I started to think of what a generalisation around the idea of twin primes would be and hit on a difference; then multiple differences; then really liked how my solution to generating a sliding group of <nowiki><count></nowiki> items from a list actually did come from the Python fundamentals:
Line 22: Line 22:
Enjoy. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 06:54, 27 April 2019 (UTC)
Enjoy. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 06:54, 27 April 2019 (UTC)
:It is very well studied, but you must state it slightly differently. Let P2 be the infinite sequence of successive primes (p2_a,P2_b) such that P2_b-P2_a=2. and P4 be the similar infinite sequence (P4_a,P4_b) such that P4_b-P4_a = 4. The your generalization to P2P4 as 3 successive primes with Pa,Pb,Pc with Pb-Pa=2 and Pc-Pb=4 is a search through P2 and P4 to find P2_b=P4_a. An interesting study would be to compute over a large range the length of P2 and P4 and thus predict the length of P2P4. For a given range should the length of P2P4 be the same as P4P2?--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 13:28, 27 April 2019 (UTC)
:It is very well studied, but you must state it slightly differently. Let P2 be the infinite sequence of successive primes (p2_a,P2_b) such that P2_b-P2_a=2. and P4 be the similar infinite sequence (P4_a,P4_b) such that P4_b-P4_a = 4. The your generalization to P2P4 as 3 successive primes with Pa,Pb,Pc with Pb-Pa=2 and Pc-Pb=4 is a search through P2 and P4 to find P2_b=P4_a. An interesting study would be to compute over a large range the length of P2 and P4 and thus predict the length of P2P4. For a given range should the length of P2P4 be the same as P4P2?--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 13:28, 27 April 2019 (UTC)

:: I was going to add a twin prime task (and cousin prime task, a difference of four), but was preempted with addition of the sexy prime (a difference of six), so I dithered a bit. &nbsp; There are other named difference primes such as devil, centennial, and millennial primes. &nbsp; However, having a Rosetta Code task just for twin primes would make the code a &nbsp; lot &nbsp; cleaner and simpler, not to mention faster. &nbsp; This would've made the task solutions more easier to compare &nbsp; (and I think more useful for people who wanted a clean and robust code for just concerning the generation of twin primes). &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 21:25, 27 April 2019 (UTC)