View Single Post
Old 2017-10-26, 09:12   #2
Citrix
 
Citrix's Avatar
 
Jun 2003

1,579 Posts
Default

I have completed this to 8M bits. Continuing.

I am using the following code to sieve. Does anyone have any suggestions on how to make this faster? Thanks.

Code:
//Adapted from multisieve

void        SuperCullenWoodallSieve::DoWork64Bit(uint64_t thePrime)
{
	uint32_t    nmin, nmax;
	nmin = 100;
	nmax = 32768;

	uint64_t    temp, power;

	temp = thePrime + 1;
	temp >> 1;
	temp = expmod62(temp, nmax*nmax, thePrime);
	power = expmod62(2, 2 * nmax, thePrime);

	for (int x = nmax; x >= nmin; x--)
	{
		if (temp == x)
			LogFactor('-', x, 2, thePrime);

		if (temp == thePrime - x)
			LogFactor('+', x, 2, thePrime);

		temp = mulmod62(temp, power, thePrime);
		if (temp&1)
		{
			temp = temp + thePrime;
		}
		temp >> 1;
		if (power&1)
		{
			power = power + thePrime;
		}
		power >> 1;
		if (power&1)
		{
			power = power + thePrime;
		}
		power >> 1;
	}
}
Citrix is offline   Reply With Quote