Talk:Sexy primes: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 15: Line 15:


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

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

Revision as of 23:16, 30 September 2018

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 1st 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)