We'll output to console not only primes, but also composites. Output to console standardized on ConsoleInterval
This commit is contained in:
1 parent
9a054542e6
commit
458cb77227
3 files changed
+8
-11
No files matched your search
@@ -15,8 +15,6 @@ internal static class Program
|
||||
private static ThreadLocal<MersenneNumberTester> MersenneTesters = null!;
|
||||
private static ThreadLocal<ModResidueTracker> PResidue = null!; // p mod d tracker (per-thread)
|
||||
private const ulong InitialP = PerfectNumberConstants.BiggestKnownEvenPerfectP;
|
||||
|
||||
private const int ConsoleInterval = 100_000;
|
||||
private const int WriteBatchSize = 100;
|
||||
private const string DefaultCyclesPath = "divisor_cycles.bin";
|
||||
private static string ResultsFileName = "even_perfect_bit_scan_results.csv";
|
||||
@@ -887,7 +885,7 @@ internal static class Program
|
||||
|
||||
lock (Sync)
|
||||
{
|
||||
if (_consoleCounter >= ConsoleInterval)
|
||||
if (_consoleCounter >= PerfectNumberConstants.ConsoleInterval)
|
||||
{
|
||||
printToConsole = true;
|
||||
primeFlag = passedAllTests && !lastWasComposite && _primeFoundAfterInit;
|
||||
|
||||
@@ -55,7 +55,7 @@ public sealed class MersenneNumberDivisorByDivisorGpuTester
|
||||
|
||||
bool composite = CheckDivisors(prime, allowedMax, out ulong lastProcessed, out bool coveredRange);
|
||||
|
||||
if (!composite && lastProcessed != 0UL)
|
||||
if (lastProcessed != 0UL)
|
||||
{
|
||||
ReportStatus(lastProcessed);
|
||||
}
|
||||
@@ -181,13 +181,11 @@ public sealed class MersenneNumberDivisorByDivisorGpuTester
|
||||
|
||||
private void ReportStatus(ulong divisor)
|
||||
{
|
||||
if (divisor <= _lastStatusDivisor)
|
||||
if (++_lastStatusDivisor == PerfectNumberConstants.ConsoleInterval)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_lastStatusDivisor = divisor;
|
||||
Console.WriteLine($"...processed by-divisor candidate = {divisor}");
|
||||
_lastStatusDivisor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static ulong ComputeDivisorLimitFromMaxPrime(ulong maxPrime)
|
||||
|
||||
@@ -3,8 +3,9 @@ namespace PerfectNumbers.Core;
|
||||
public static class PerfectNumberConstants
|
||||
{
|
||||
public const ulong BiggestKnownEvenPerfectP = 136279841UL;
|
||||
public static readonly uint PrimesLimit = 1_000_000; //(ulong)Array.MaxLength;// 1_000_000;
|
||||
public const int MaxQForDivisorCycles = 4_000_000;
|
||||
public const int ConsoleInterval = 100_000;
|
||||
public const ulong ExtraDivisorCycleSearchLimit = 64UL;
|
||||
public const int MaxQForDivisorCycles = 4_000_000;
|
||||
public static readonly uint PrimesLimit = 1_000_000; //(ulong)Array.MaxLength;// 1_000_000;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user