Thread: mtsieve enhancements View Single Post
2020-05-27, 16:54   #25
Citrix

Jun 2003

112·13 Posts

Quote:
 Originally Posted by rogue I will table your other suggestions because I don't understand them.
I am suggesting using a few more primes, other than 2, like 3,5,7,13 etc (Covering sets)
The code below is from mtsieve for prime 2.

Code:
 // If the base is odd, then all n must be even and thus the difference
// between any two remaining n for the base must also be even.
if (idx > 2 && ii_Base & 1)
{
if (idx & 1)
continue;

avx_set_16a(powers[idx-2]);
avx_set_16b(powers[2]);
avx_mulmod(dps, reciprocals);
avx_get_16a(powers[idx]);
}
else
{
avx_set_16a(powers[idx-1]);
avx_set_16b(powers[1]);
avx_mulmod(dps, reciprocals);
avx_get_16a(powers[idx]);
}