Talk:Prime conspiracy

From Rosetta Code
Revision as of 20:39, 22 March 2016 by rosettacode>Gerard Schildberger (→‎primes ending in 2 or 5: used different types of brackets to not have nested parenthesis.)

numbers in the example for the task (deprecated)

For 10,000 primes   (as shown by the example in the Rosetta Code task), my numbers (using the REXX program)   don't match those shown:

For  10000  primes used in this study:

H= 80000
prime  10001  is:  84327

digit  1 ──► 1  has a count of:   281,  frequency of:   2.81%.
digit  1 ──► 3  has a count of:  1094,  frequency of:  10.94%.
digit  1 ──► 7  has a count of:   697,  frequency of:   6.97%.
digit  1 ──► 9  has a count of:   308,  frequency of:   3.08%.

digit  3 ──► 1  has a count of:   417,  frequency of:   4.17%.
digit  3 ──► 3  has a count of:   236,  frequency of:   2.36%.
digit  3 ──► 7  has a count of:   588,  frequency of:   5.88%.
digit  3 ──► 9  has a count of:   719,  frequency of:   7.19%.

digit  7 ──► 1  has a count of:   512,  frequency of:   5.12%.
digit  7 ──► 3  has a count of:   578,  frequency of:   5.78%.
digit  7 ──► 7  has a count of:   254,  frequency of:   2.54%.
digit  7 ──► 9  has a count of:  1059,  frequency of:  10.59%.

digit  9 ──► 1  has a count of:  1170,  frequency of:  11.70%.
digit  9 ──► 3  has a count of:   485,  frequency of:   4.85%.
digit  9 ──► 7  has a count of:   431,  frequency of:   4.31%.
digit  9 ──► 9  has a count of:   302,  frequency of:   3.02%.

Does anyone else match either set of numbers for 10,000 primes?   -- Gerard Schildberger (talk) 22:32, 21 March 2016 (UTC)


Never mind, I found the problem   (had to do with the calculation of the upper bound for the sieve).   I did think it strange that my calculations for 1,000,000 primes was correct, but not for 10,000. -- Gerard Schildberger (talk) 23:42, 21 March 2016 (UTC)


I get a different result. Also, prime 10001 is 104759. Prime 8220 is 84327. Prime 0 is 2. So that's probably your issue. --Rdm (talk) 22:42, 21 March 2016 (UTC)

The REXX language (usually) starts out an index with unity, not zero.   -- Gerard Schildberger (talk) 23:49, 21 March 2016 (UTC)

Pascal results also match the numbers given in the example. --G.Brougnard (talk) 22:48, 21 March 2016 (UTC)


primes ending in 2 or 5

[The below was disunioned from the previous (deprecated) talk section.]   -- Gerard Schildberger (talk) 20:37, 22 March 2016 (UTC)


Ok. Of course, the Pascal result also does not show the transitions involving the prime numbers 2 and 5. --Rdm (talk) 00:03, 22 March 2016 (UTC)
And also, it doesn't show the transitions involving the prime number 3 and the number 5.   -- Gerard Schildberger (talk) 00:30, 22 March 2016 (UTC)
True. I didn't mention 3 because (a) its transitions are already covered in the other two, and (2) the digit 3 shows up in the pascal and rexx tables, so it's not as obvious of a statement. (If you make 2 and 5 show up, you'd have to fix the omission of 3 as well). Anyways, I guess the point is that there's an error there that should probably be fixed sooner or later? --Rdm (talk) 01:29, 22 March 2016 (UTC)
I changed my original pascal result, including the transitions 2->3,3->5,5->7, because of the example in front of the task, where they aren't mentioned ;-)

<lang pascal> res := Trs[0].CTR_CntTrans[i,j];

     //not counting 2->3,3->5,5->7
     IF res > 1 then</lang>
I also (regarding REXX) didn't show the transitions for primes ending in 2 or 5, as the task (apparently) didn't require it   (as it didn't reflect those in the example output).   Since there are exactly three of those (total), it didn't seem that it should/would be beneficial just to add those particular counts to the output as they'll just appear as constants   (for any list showing more than three or more prime).   -- Gerard Schildberger (talk) 20:37, 22 March 2016 (UTC)