Formatting cleanup
This commit is contained in:
1 parent
af0131d446
commit
48d11c08f0
1 file changed
+37
-37
@@ -25,8 +25,8 @@ internal static class Program
|
|||||||
private static int _primeCount;
|
private static int _primeCount;
|
||||||
private static bool _primeFoundAfterInit;
|
private static bool _primeFoundAfterInit;
|
||||||
private static bool _useGcdFilter;
|
private static bool _useGcdFilter;
|
||||||
private static bool _useDivisor;
|
private static bool _useDivisor;
|
||||||
private static UInt128 _divisor;
|
private static UInt128 _divisor;
|
||||||
private static MersenneNumberDivisorGpuTester? _divisorTester;
|
private static MersenneNumberDivisorGpuTester? _divisorTester;
|
||||||
private static ulong? _orderWarmupLimitOverride;
|
private static ulong? _orderWarmupLimitOverride;
|
||||||
private static unsafe delegate*<ulong, ref ulong, ulong> _transformP;
|
private static unsafe delegate*<ulong, ref ulong, ulong> _transformP;
|
||||||
@@ -58,9 +58,9 @@ internal static class Program
|
|||||||
bool showHelp = false;
|
bool showHelp = false;
|
||||||
bool useBitTransform = false;
|
bool useBitTransform = false;
|
||||||
bool useLucas = false;
|
bool useLucas = false;
|
||||||
bool useResidue = false; // M_p test via residue divisors (replaces LL/incremental)
|
bool useResidue = false; // M_p test via residue divisors (replaces LL/incremental)
|
||||||
bool useDivisor = false; // M_p divisibility by specific divisor
|
bool useDivisor = false; // M_p divisibility by specific divisor
|
||||||
UInt128 divisor = UInt128.Zero;
|
UInt128 divisor = UInt128.Zero;
|
||||||
// Device routing
|
// Device routing
|
||||||
bool useGpuCycles = true;
|
bool useGpuCycles = true;
|
||||||
bool mersenneOnGpu = true; // controls Lucas/incremental/pow2mod device
|
bool mersenneOnGpu = true; // controls Lucas/incremental/pow2mod device
|
||||||
@@ -69,9 +69,9 @@ internal static class Program
|
|||||||
ulong residueKMax = 5_000_000UL;
|
ulong residueKMax = 5_000_000UL;
|
||||||
string filterFile = string.Empty;
|
string filterFile = string.Empty;
|
||||||
string cyclesPath = DefaultCyclesPath;
|
string cyclesPath = DefaultCyclesPath;
|
||||||
int cyclesBatchSize = 512;
|
int cyclesBatchSize = 512;
|
||||||
bool continueCyclesGeneration = false;
|
bool continueCyclesGeneration = false;
|
||||||
ulong divisorCyclesSearchLimit = PerfectNumberConstants.ExtraDivisorCycleSearchLimit;
|
ulong divisorCyclesSearchLimit = PerfectNumberConstants.ExtraDivisorCycleSearchLimit;
|
||||||
|
|
||||||
// NTT backend selection (GPU): reference vs staged
|
// NTT backend selection (GPU): reference vs staged
|
||||||
for (int i = 0; i < args.Length; i++)
|
for (int i = 0; i < args.Length; i++)
|
||||||
@@ -128,16 +128,16 @@ internal static class Program
|
|||||||
kernelType = GpuKernelType.Incremental;
|
kernelType = GpuKernelType.Incremental;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (arg.StartsWith("--divisor=", StringComparison.OrdinalIgnoreCase))
|
else if (arg.StartsWith("--divisor=", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
int eq = arg.IndexOf('=');
|
int eq = arg.IndexOf('=');
|
||||||
divisor = UInt128.Parse(arg.AsSpan(eq + 1));
|
divisor = UInt128.Parse(arg.AsSpan(eq + 1));
|
||||||
}
|
}
|
||||||
else if (arg.StartsWith("--divisor-cycles-limit=", StringComparison.OrdinalIgnoreCase))
|
else if (arg.StartsWith("--divisor-cycles-limit=", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
int eq = arg.IndexOf('=');
|
int eq = arg.IndexOf('=');
|
||||||
divisorCyclesSearchLimit = ulong.Parse(arg.AsSpan(eq + 1));
|
divisorCyclesSearchLimit = ulong.Parse(arg.AsSpan(eq + 1));
|
||||||
}
|
}
|
||||||
else if (arg.StartsWith("--residue-max-k=", StringComparison.OrdinalIgnoreCase))
|
else if (arg.StartsWith("--residue-max-k=", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
int eq = arg.IndexOf('=');
|
int eq = arg.IndexOf('=');
|
||||||
@@ -438,15 +438,15 @@ internal static class Program
|
|||||||
return tester;
|
return tester;
|
||||||
}, trackAllValues: true);
|
}, trackAllValues: true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (divisor == UInt128.Zero)
|
if (divisor == UInt128.Zero)
|
||||||
{
|
{
|
||||||
MersenneNumberDivisorGpuTester.BuildDivisorCandidates();
|
MersenneNumberDivisorGpuTester.BuildDivisorCandidates();
|
||||||
}
|
}
|
||||||
|
|
||||||
_divisorTester = new MersenneNumberDivisorGpuTester();
|
_divisorTester = new MersenneNumberDivisorGpuTester();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load RLE blacklist (optional)
|
// Load RLE blacklist (optional)
|
||||||
if (!string.IsNullOrEmpty(_rleBlacklistPath))
|
if (!string.IsNullOrEmpty(_rleBlacklistPath))
|
||||||
@@ -916,10 +916,10 @@ internal static class Program
|
|||||||
return next + value;
|
return next + value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
internal static bool IsEvenPerfectCandidate(ulong p, ulong divisorCyclesSearchLimit) => IsEvenPerfectCandidate(p, divisorCyclesSearchLimit, out _, out _);
|
internal static bool IsEvenPerfectCandidate(ulong p, ulong divisorCyclesSearchLimit) => IsEvenPerfectCandidate(p, divisorCyclesSearchLimit, out _, out _);
|
||||||
|
|
||||||
internal static bool IsEvenPerfectCandidate(ulong p, ulong divisorCyclesSearchLimit, out bool searchedMersenne, out bool detailedCheck)
|
internal static bool IsEvenPerfectCandidate(ulong p, ulong divisorCyclesSearchLimit, out bool searchedMersenne, out bool detailedCheck)
|
||||||
{
|
{
|
||||||
searchedMersenne = false;
|
searchedMersenne = false;
|
||||||
detailedCheck = false;
|
detailedCheck = false;
|
||||||
@@ -982,15 +982,15 @@ internal static class Program
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchedMersenne = true;
|
searchedMersenne = true;
|
||||||
if (_useDivisor)
|
if (_useDivisor)
|
||||||
{
|
{
|
||||||
return _divisorTester!.IsPrime(p, _divisor, divisorCyclesSearchLimit, out detailedCheck);
|
return _divisorTester!.IsPrime(p, _divisor, divisorCyclesSearchLimit, out detailedCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
detailedCheck = MersenneTesters.Value!.IsMersennePrime(p);
|
detailedCheck = MersenneTesters.Value!.IsMersennePrime(p);
|
||||||
return detailedCheck;
|
return detailedCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use ModResidueTracker with a small set of primes to pre-filter composite p.
|
// Use ModResidueTracker with a small set of primes to pre-filter composite p.
|
||||||
private static bool IsCompositeByResidues(ulong p)
|
private static bool IsCompositeByResidues(ulong p)
|
||||||
|
|||||||
Reference in new issue
Block a user