# Talk:Sexy primes

## Successive prime differences

Sexy primes isn't significantly different from successive primes. Rosetta code is about algorithmic expression rather than tricking programmers into not searching through highest prime plus six. Please remove the task. --LambertDW 15:16, 20 May 2019 (UTC)

- I think the problem is with the Successive Primes task. Which primes separated by 2 are not successive? (none). Which primes separated by 4 are not successive? (only 3 and 7 with 5 playing gooseberry). Interest begins at 6 when 7 and 13 are a sexy pair but are not successive (11 playing gooseberry). So we have a sequence of sexy primes starting at 7, and a sequence of successive primes separated by 6 starting at 31 which is a subset of the sexy primes. Beyond being a subset what other relationships exist? What happens beyond 6? As it stands the Successive Primes task offers no insight into Successive Primes. I have added 2 references to that task. The first looks at the number theoretic issues, the second at some interesting questions that can be asked about Successive Primes. Another contributor has added a third reference which takes one of the questions asked in 2 (what is the longest sequence of Successive Primes with increasing separation?) to the max.--Nigel Galloway (talk) 10:26, 21 May 2019 (UTC)

- I think both tasks should remain. Maybe this task could be better worded - it's still in draft, and now is the time to suggest/make improvements?

--Paddy3118 (talk) 10:40, 21 May 2019 (UTC)

## last 5

For slightly neater output, I (Phix) implemented "last 5" as "at most last 5", then cheekily changed the task description accordingly. Should anyone object, speak up. Pete Lomax (talk) 00:07, 13 November 2018 (UTC)

## possible errors in most programs

The task's author used **1,000,000** as a test case upper limit.

However, if he had chosen **100**, most computer programs would give an erroneous number of unsafe primes, as **97** is a sexy prime. Most computer programs only check up to **N**. As of this writing, only REXX checks for sexy primes up to **N + 6**, and carefully programs not to list sexy primes over the upper limit (but still finds but not displays the upper half of sexy prime pairs if it exceeds the upper limit).

Also, it isn't clear that in the case of **100** being the upper limit, should **97** be listed as the 1^{st} half of a sexy prime __pair__ if the top part of the pair is above the upper limit?

Now, it so happens that the next six numbers after 1,000,000 are all composite, so all the program results are correct, even if they lucked out. However, for the general case, **100** would be a good additional test case to count the number of sexy primes (or unsexy primes). Computer programs should behave correctly with a different upper limit.

I suggest that another task requirement would be to display the number of sexy (or unsexy) primes below **100**. -- Gerard Schildberger (talk) 01:16, 30 September 2018 (UTC)

- I don't read it that way , as it mentions group and 97 is grouped with 103 and so straddles the limit. Paddy3118 (talk) 09:30, 30 September 2018 (UTC)

- Hmm. Fair point, in part at least. As I see it, if the limit is 100, 97 should not be listed as a pair, even though it would be with a higher limit. It
**should**be caught as a sexy prime though, and so**should not**be listed in the unsexy primes. I am somewhat disinclined to make testing at a limit of 100 an*additional*requirement. I would rather make the limit 1_000_035 which splits the pair 1000033,100039 and ensure that 1000033 is not listed as unsexy nor as a pair (it's sexy, but not a pair within the limit). --Thundergnat (talk) 15:38, 30 September 2018 (UTC)

- Maybe say start|end of prime group is <= limit? It is pretty easy to cover either case. CraigD (talk)

- My first point raised is that
**97**is a sexy prime (with a limit of**100**). Most people's attention was directed to the query about whether that**97**should/shouldn't be listed as a sexy prime__pair__. My first query was that if the (a) limit was**100**, programs could easily be checked and verified that they worked (or not) regarding whether or not**97**would be listed or counted as a sexy prime (or failing that, whether it would be listed or counted as an unsexy prime). With a limit over**1,000,000**, it would be harder to verify (witness that one computer program already has an incorrect count for the number of unsexy primes, but hasn't be questioned or flagged.) Listing the sexy primes under**100**would've been a simpler way. But, as it turns out, everybody's program's output has to be changed to handle the new limits. -- Gerard Schildberger (talk) 23:16, 30 September 2018 (UTC)

- My first point raised is that

- Did I not address your query "
**should 97 be listed as the 1st half of a sexy prime pair?**" in my second and third statements? In what way could I have made it clearer?

- Did I not address your query "

- "
**Listing the sexy primes under 100 would've been a simpler way.**" In what way? Each relevant count is already required to be displayed. It*was*ambiguous about the splitting of pairs (which I clarified). I suppose there could be some confusion over whether the threshold value should be included or not, but I purposely chose a value where it didn't matter (because I wanted to test for other constraints). There is little else that is open to interpretation. If you are unable to tell that the count your entry outputs is different from all other entries, I think there are larger problems.

- "

- "
**everybody's program's output has to be changed to handle the new limits**" Seriously? I'm sorry your chosen programming language is so difficult to run. Mine took less than a minute to modify, re-run and copy-paste the new output. Really, adding an additional required test at 100 probably**also**would have required you to update your output, so I fail to see why that is a hardship.

- "

- "
**(witness that one computer program already has an incorrect count for the number of unsexy primes, but hasn't be questioned or flagged.)**" Ok, but if it was the entry I questioned and flagged (hmmm) it wasn't incorrect for any of the things you raised issue with. --Thundergnat (talk) 12:46, 1 October 2018 (UTC)

- "

- Yes, you addressed my query, To use your words, ... in part,
*at least*. At that point, there was no way to confirm if any programming entry handled the case of a*straddled*sexy prime pair (except for the REXX entry), so therefore, there wasn't any way for me to verify (other than running the programs myself) if the other programs were correct, as their outputs didn't reflect whether or not sexy primes were being counted correctly for*straddled*sexy pair primes (since at time, none of the task's requirements encountered a straddled sexy prime pair). I choose to instead, open a new talk section addressing this issue (and have since regretted it, for the obvious reasons, ··· no good turn goes unpunished ··· or unharangued). Any-a-whose, trodding on ... At that time, you*would rather make ...*changes to the requirements, but you had not yet done so, so it appeared to me that you didn't want to address this issue directly or at that time. That issue is now moot as the updated task requirements have included a straddled sexy prime pair, so I am assuming that you changed the task's requirements to ensure/verify their correctness (program logic) regarding this issue. I am now regretting even bringing up the problem, the next time I just may let sleeping dogs lie. All this for merely exposing a potential/possible problem, which apparently, as it turns out, there was a problem. -- Gerard Schildberger (talk) 00:05, 2 October 2018 (UTC)

- Yes, you addressed my query, To use your words, ... in part,

- It would've been simpler in that all the unsexy primes (under 100) could've been listed (counts would've shown a problem, but I think most programmers would've like to know what exactly which primes were being counted incorrectly, or not being included or included incorrectly), and programmers could see then if
**97**was or wasn't listed (as I'm assuming that would be the problematic prime). I don't know where you got the idea that I was unable to tell that my count was different from all the others. I was, obviously, able to tell the difference, as that was the main reason that I created this discussion page section entry. My entry's output was different from only**one**other entry (the one that I was referring to). At that time, mine*only*agreed with two other entries, with another entry which didn't list the number of unsexy primes at that time (however, the count has since been added). Please don't put on me that there are larger problems (supposedly because I can't tell the difference, because, it__must be__obvious that I can tell the difference, since I created this section on the discussion/talk page). If you don't whether that I can or can't, then you can just ask instead of assuming that I can't (all evidence to the contrary). Rosetta Code isn't a place for ad hominem attacks (or even snide suggestions, no matter how phrased). -- Gerard Schildberger (talk) 00:05, 2 October 2018 (UTC)

- It would've been simpler in that all the unsexy primes (under 100) could've been listed (counts would've shown a problem, but I think most programmers would've like to know what exactly which primes were being counted incorrectly, or not being included or included incorrectly), and programmers could see then if

- Again, you're assuming that it was (or would be) a hardship. I never mentioned anything or implied that there was/is a hardship. So there is no need to fail to see why there would be a hardship ··· if there
*is*no hardship. Sooooo, no need to be sorry for any non-hardship. Furthermore, the additional requirement that I suggested could've been added as an*optional*requirement, thus not necessitating a change if one didn't want to list all (three) unsexy primes below**100**. -- Gerard Schildberger (talk) 00:05, 2 October 2018 (UTC)

- Again, you're assuming that it was (or would be) a hardship. I never mentioned anything or implied that there was/is a hardship. So there is no need to fail to see why there would be a hardship ··· if there

- Since the entry that you flagged wasn't the entry that I noticed was different (and possibly thought was incorrect, but not for certain at that time), and you thought that I was talking about the entry you flagged (which it wasn't), so you're saying that it wasn't correct for the points that I raised. Well, yes, I wasn't even talking about the entry that you flagged, but another entry, so yes, we are talking about two different entries. So therefore, my points that I mentioned don't even apply to the entry you're referring to. Also, I don't know where you got the impression that it is so difficult to re-run
*my*chosen programming language. You're again making an assumption (well, actually two assumptions). There is no reason for you to be sorry for something that isn't true. Also, I don't know why you assumed it was a hardship. That was and is not the case. So your failure to see why it was a hardship also isn't a failure, as there wasn't any hardship. Now, for the entry you questioned and flagged. Again, it was not__that__programming entry that I had noticed that appeared to be incorrect (I was waiting for more programming entries to show their output which would've hopefully clarified the issue). As it turned out, it was later changed/corrected (without it being flagged). But, you were wrong, as you assumed that it was the entry (the one that you flagged) that I was referring to, it was different entry. So I rather resent the fact that I found (as it turned out) an incorrect output, and you thought that I meant another incorrect output, and you further assumed that it wasn't for any of the reasons that I raised. Oy! -- Gerard Schildberger (talk) 00:05, 2 October 2018 (UTC)

- Since the entry that you flagged wasn't the entry that I noticed was different (and possibly thought was incorrect, but not for certain at that time), and you thought that I was talking about the entry you flagged (which it wasn't), so you're saying that it wasn't correct for the points that I raised. Well, yes, I wasn't even talking about the entry that you flagged, but another entry, so yes, we are talking about two different entries. So therefore, my points that I mentioned don't even apply to the entry you're referring to. Also, I don't know where you got the impression that it is so difficult to re-run

- "
**At that time, you**" Let's just check the edit history, shall we? Time when I made that comment:*would rather make ...*changes to the requirements, but you had not yet done so, so it appeared to me that you didn't want to address this issue directly or at that time.*15:38, 30 September 2018*. Time when I made the changes to the task requirements:*15:46, 30 September 2018*. Elapsed time:**8**minutes. Personally,**I**don't think that was too unreasonable but you are entitled to your opinion.

- "

**"In response to your entire second and third paragraphs"***Not gonna quote the whole things...*You made slightly ridiculous claims so I made slightly ridiculous replies. Humor doesn't come across very well in text. However, I*do*think you complain an awful lot about crap that doesn't much matter. (My own personal opinion, not necessarily shared by anyone else.) Nothing personal. You're obviously an intelligent person and care about the quality of the site, but the way you go about expressing it I find particularly grating. (And it's quite~~possible~~likely that I'm just an a**hole. Meh, I'll manage to live with it.)

**"So I rather resent the fact that I found (as it turned out) an incorrect output, and you thought that I meant another incorrect output"**Make me play guessing games and then get all bent when I guess? Ok. Resent away. --Thundergnat (talk) 11:46, 2 October 2018 (UTC)

- No, it's not that you guessed wrong (and created a strawman argument), but that you characterized my opinions either as ridiculous and/or that I couldn't tell if my (output) count was different than another's. (I obviously did know the difference). It was your pejorative statements and name calling that caused me "to get all bent" as you characterized it. I'd like this jabbing to stop, as it doesn't reflect well on Rosetta Code to shoot the messenger. This matters to me and it's not just crap (your word). We should be able to discuss topics freely without this kind of thing. I had opened this discussion page with the intent to make aware that most computer programs
*seemed*incorrect at that time (as they didn't take into account*straddled*sexy primes as far as I could discern). -- Gerard Schildberger (talk) 16:12, 6 October 2018 (UTC)

- No, it's not that you guessed wrong (and created a strawman argument), but that you characterized my opinions either as ridiculous and/or that I couldn't tell if my (output) count was different than another's. (I obviously did know the difference). It was your pejorative statements and name calling that caused me "to get all bent" as you characterized it. I'd like this jabbing to stop, as it doesn't reflect well on Rosetta Code to shoot the messenger. This matters to me and it's not just crap (your word). We should be able to discuss topics freely without this kind of thing. I had opened this discussion page with the intent to make aware that most computer programs

**"I had opened this discussion page with the intent to make aware that most computer programs seemed incorrect at that time (as they didn't take into account straddled sexy primes as far as I could discern)**" And I agreed and promptly changed the task to make that shortcoming obvious. Why is there still a problem?

**"This matters to me and it's not just crap (your word)."**It seems to me that the "this" you are referring is not Rosetta Code, but your wounded pride and outrage that someone had the temerity to disagree with you, and by all that is holy, you're not going to let that go... um, what's the word I'm looking for... oh yes! unharangued. In that case, yep, it's crap. --Thundergnat (talk) 17:41, 6 October 2018 (UTC)

- Why not simply define:

SP pairs as n such that n<1000035 and n is prime and n-6 is prime

SP triplets as n is a member of the set of SP pairs and n-12 is prime

SP quadruplets as n is a member of the set of SP triplets and n-18 is prime

SP quintuplets as n is a member of the set of SP quadruplets and n-24 is prime

Unsexy primes as n<1000035 and n is prime and n-6 is not prime and n+6 is not prime

--Nigel Galloway (talk) 12:54, 2 October 2018 (UTC)

- I too don't like the idea of needing to look beyond the given "limit" to check sexiness. When is a limit not a limit? When you are forced to look beyond it. Paddy3118 (talk) 12:47, 3 October 2018 (UTC)
- Do you mean not needing, otherwise I can make no sense of the above, either way perhaps you could clarify what you'd like to change. In the Python program you define primeset. You then write 'for p in primes' which recalculates the primes, why don't you instead say for p in primeset? You define 'primearray = [n in primeset for n in range(LIMIT)]' where is primearray actually used?--Nigel Galloway (talk) 12:20, 4 October 2018 (UTC)

- (in reply to Paddy3118) Let me explain my reasoning with an analogous (though slightly bogus) example: Suppose we had some hypothetical task: "
**List the positive integers less than 50 whose square contains a digit '1'**". Would you argue that only 1 and 4 should be listed? After all, the limit is 50, and 9, 10, 11, etc. have (all numbers larger than 7 have) a square greater than the limit. The task is asking for numbers within a limit that have a certain property. The fact that having that property may depend on numbers outside of that limit doesn't change that it has that property. --Thundergnat (talk) 12:54, 4 October 2018 (UTC)

- (in reply to Paddy3118) Let me explain my reasoning with an analogous (though slightly bogus) example: Suppose we had some hypothetical task: "