From 1b1697d4dad28fe93e1f170904bc9eda46fa7571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Lema=C5=84czyk?= Date: Thu, 11 Sep 2025 18:41:18 +0200 Subject: [PATCH] Search limit for divisor sets made configurable --- EvenPerfectBitScanner.Tests/ProgramTests.cs | 4 ++-- EvenPerfectBitScanner/Program.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/EvenPerfectBitScanner.Tests/ProgramTests.cs b/EvenPerfectBitScanner.Tests/ProgramTests.cs index 5cf366e..3e2ffd1 100644 --- a/EvenPerfectBitScanner.Tests/ProgramTests.cs +++ b/EvenPerfectBitScanner.Tests/ProgramTests.cs @@ -88,8 +88,8 @@ public class ProgramTests try { - Program.IsEvenPerfectCandidate(11UL).Should().BeFalse(); - Program.IsEvenPerfectCandidate(5UL).Should().BeTrue(); + Program.IsEvenPerfectCandidate(11UL, 32).Should().BeFalse(); + Program.IsEvenPerfectCandidate(5UL, 32).Should().BeTrue(); } finally { diff --git a/EvenPerfectBitScanner/Program.cs b/EvenPerfectBitScanner/Program.cs index 4d482d1..ec1153a 100644 --- a/EvenPerfectBitScanner/Program.cs +++ b/EvenPerfectBitScanner/Program.cs @@ -623,7 +623,7 @@ internal static class Program Console.WriteLine($"Testing {p}"); } - bool isPerfect = IsEvenPerfectCandidate(p, out bool searchedMersenne, out bool detailedCheck); + bool isPerfect = IsEvenPerfectCandidate(p, divisorCyclesSearchLimit, out bool searchedMersenne, out bool detailedCheck); PrintResult(p, searchedMersenne, detailedCheck, isPerfect); } } @@ -949,9 +949,9 @@ internal static class Program } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static bool IsEvenPerfectCandidate(ulong p) + internal static bool IsEvenPerfectCandidate(ulong p, int divisorCyclesSearchLimit) { - return IsEvenPerfectCandidate(p, out _, out _); + return IsEvenPerfectCandidate(p, divisorCyclesSearchLimit, out _, out _); } internal static bool IsEvenPerfectCandidate(ulong p, int divisorCyclesSearchLimit, out bool searchedMersenne, out bool detailedCheck)