Talk:Emirp primes: Difference between revisions

→‎reason for 3 invokes: --- possible solution to spec.
(→‎reason for 3 invokes: --- possible solution to spec.)
 
(2 intermediate revisions by 2 users not shown)
Line 45:
 
-----
 
Naive suggestion: This task requires that the same program, in separate runs, should output the first ''i'' emirps in numerical order, all the emirps between ''j'' and ''k'' inclusive in numerical order and the ''n''th emirp, where ''i, j, k'' and ''n'' should be taken from the command line, from user input, from a dialog box or from some other mechanism appropriate to the conventional usage of the language of implementation. Suggested values for ''i, j, k'' and ''n'' are 20, 7000, 8000 and 10000 respectively.
--[[User:Brnikat|Brnikat]] ([[User talk:Brnikat|talk]]) 20:32, 11 July 2015 (UTC)
 
===New task: [[Extensible prime generator]]===
Line 56 ⟶ 59:
 
:: For the specific number you mention I would use the Sieve of Atkin (to show off) to generate prime numbers up to 41, then test the number by trial division of these primes. More relevant to this task is how would I find all 4 digit emirps. Using the Sieve of Atkin I would generate all primes up to 99. Then test each odd number not ending in 5 in the ranges 1001-1999 (using primes up to 45), 3001-3999(using primes up to 63), 7001-7999(using primes up to 89), and 9001-9999(using primes up to 99). Then for each of these 4 lists of candidates test if the reversed number is in the appropriate other list. For all 5 digit emirps use Atkin to generate all primes up to 361. Then test each odd number not ending in 5 in the ranges 10001-19999 (using primes up to 141), 30001-39999(using primes up to 199), 70001-79999(using primes up to 282), and 90001-99999(using primes up to 316). Then for each of these 4 lists of candidates test if the reversed number is in the appropriate other list. etc, etc, ....--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 13:30, 27 March 2014 (UTC)
 
:: It is probably faster not to calculate the list starting with 9 but to test for primeality when a Candidate in the 3 lists starting with 1, 3, or 7 ends in a 9.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 13:51, 27 March 2014 (UTC)
::: When counting Emirps, one using trial division could use the fact, that Emirps out of 10..01 to 19..99 are mirrored in 9...1,7....1,3...1 and 1...1.What does this mean. I don't need to test numbers ending with "1" when I count them while testing 1....., so 3.... only needs to test Emirp for last digit element of '3,7,9' after that 7...... need tests only for '7,9', at least 9.... need only test for last digit = 9.That nearly halves the tests needed.
Anonymous user