Add heuristic prime sieves for cached divisor sequences
This commit is contained in:
1 parent
4ee6464130
commit
15c229665d
10 files changed
+1597
-364
No files matched your search
@@ -41,6 +41,17 @@ internal static class PrimeTesterKernels
|
||||
results[index] = composite ? (byte)0 : (byte)1;
|
||||
}
|
||||
|
||||
public static void HeuristicTrialDivisionKernel(Index1D index, ArrayView<ulong> divisors, ulong n, ArrayView<byte> results)
|
||||
{
|
||||
ulong divisor = divisors[index];
|
||||
if (divisor <= 1UL)
|
||||
{
|
||||
results[index] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
results[index] = n % divisor == 0UL ? (byte)1 : (byte)0;
|
||||
}
|
||||
|
||||
public static void SharesFactorKernel(Index1D index, ArrayView<ulong> numbers, ArrayView<byte> results)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user