Talk:CalmoSoft primes: Difference between revisions

→‎Sequence length: Discovered what was making {2, 3, 5} wheel slower.
(→‎Sequence length: Previous test was unfair to M-R.)
(→‎Sequence length: Discovered what was making {2, 3, 5} wheel slower.)
 
Line 45:
 
:::An area I've been investigating is how best to check if the candidate sequence sums are prime or not which is quite slow in Wren for the larger sums. My 'Int.isPrime' routine uses an implicit {2, 3} basis for wheel factorization which, curiously, seems optimal for Wren - if I try to use {2, 3, 5} as in the C++ example - it's slightly slower.
 
::::Just as a matter of interest, it turned out that what was making the {2, 3, 5} basis wheel slightly slower than {2, 3} in Wren was the cost of accessing the wheel increments via a list. If I don't use a list, then it's 25% quicker! --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 10:04, 27 April 2023 (UTC)
 
:::However, what does help is to use the Miller-Rabin test instead which brings the overall time down from 4.3 to 3.5 seconds. Unfortunately, you can't use this for checking primality generally as it's much slower than wheel-based factorization if you're checking a block of numbers which are mostly non-prime. I checked the first 1 million integers for primeness and Miller-Rabin took about 30 times as long. It's best used therefore for checking isolated large numbers as we have for this task. --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 11:06, 12 April 2023 (UTC)
9,476

edits