Use divisor squares to bound heuristic combined trial division
This commit is contained in:
1 parent
4ab77ba170
commit
b0158a844a
4 files changed
+351
-235
No files matched your search
@@ -68,16 +68,18 @@ internal static class PrimeTesterKernels
|
||||
results[index] = result;
|
||||
}
|
||||
|
||||
public static void HeuristicTrialDivisionKernel(Index1D index, ArrayView<ulong> divisors, ulong n, ArrayView<byte> results)
|
||||
public static void HeuristicTrialDivisionKernel(Index1D index, ArrayView<ulong> divisors, ulong n, ArrayView<byte> resultFlag)
|
||||
{
|
||||
ulong divisor = divisors[index];
|
||||
if (divisor <= 1UL)
|
||||
{
|
||||
results[index] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
results[index] = n % divisor == 0UL ? (byte)1 : (byte)0;
|
||||
if (n % divisor == 0UL)
|
||||
{
|
||||
resultFlag[0] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SharesFactorKernel(Index1D index, ArrayView<ulong> numbers, ArrayView<byte> results)
|
||||
|
||||
Reference in new issue
Block a user