Talk:Sexy primes: Difference between revisions

From Rosetta Code
Content added Content deleted
(Fair point, but I would go about demonstrating it differently)
Line 11: Line 11:


:I don't read it that way , as it mentions group and 97 is grouped with 103 and so straddles the limit. [[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 09:30, 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. [[User:Paddy3118|Paddy3118]] ([[User talk: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). --[[User:Thundergnat|Thundergnat]] ([[User talk:Thundergnat|talk]]) 15:38, 30 September 2018 (UTC)

Revision as of 15:39, 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)