From 0eb511aaff1ada243d50c882b77c229dbdd1b031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Lema=C5=84czyk?= Date: Fri, 13 Feb 2026 01:02:42 +0100 Subject: [PATCH] BitContradiction rules improved. --- .../BitContradictionSolverWithAMultiplier.cs | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/PerfectNumbers.Core/ByDivisor/BitContradictionSolverWithAMultiplier.cs b/PerfectNumbers.Core/ByDivisor/BitContradictionSolverWithAMultiplier.cs index 0c5884a..6a8e17e 100644 --- a/PerfectNumbers.Core/ByDivisor/BitContradictionSolverWithAMultiplier.cs +++ b/PerfectNumbers.Core/ByDivisor/BitContradictionSolverWithAMultiplier.cs @@ -234,7 +234,7 @@ internal static class BitContradictionSolverWithAMultiplier { Atomic.Add(ref counter, 1UL); _pruneStatsConsoleCounter++; - if (_pruneStatsConsoleCounter < PerfectNumberConstants.ConsoleInterval) + if (true || _pruneStatsConsoleCounter < PerfectNumberConstants.ConsoleInterval) { return; } @@ -2470,6 +2470,8 @@ internal static class BitContradictionSolverWithAMultiplier totalTransitionsOver10++; } + previousCarryOut = carryOut; + if (carryOut == 6) { totalCarry6Count++; @@ -2683,7 +2685,11 @@ internal static class BitContradictionSolverWithAMultiplier return true; } - if ((totalCarry8Count & 1) == 0 && (totalCarry9Count & 1) == 0 && (totalCarry10Count & 1) == 0) + bool totalCarry8CountIsEven = (totalCarry8Count & 1) == 0; + bool totalCarry9CountIsEven = (totalCarry9Count & 1) == 0; + if (totalCarry8CountIsEven && totalCarry9CountIsEven && + ((totalCarry10Count & 1) == 0 || (totalCarry11Count > totalCarry10Count && totalCarry8Count > 14 && totalCarry11Count > totalCarry9Count && totalCarry11Count > totalCarry8Count)) + ) { pruneReason = CarryDropPruneReason.Dominance10AndMoreDrop; #if WITH_PRUNE_STATS @@ -2692,7 +2698,35 @@ internal static class BitContradictionSolverWithAMultiplier return true; } - if (totalCarryAbove10 >= 850 && totalCarryBelow10 < 100 && shortestStreakBelow10 <= 3 && longestStreakBelow10 <= 12 && totalCarry11Count < 150 && lastStreakBelow10 < 12) + bool totalCarry10CountIsEven = (totalCarry10Count & 1) == 0; + bool totalCarry11CountIsEven = (totalCarry11Count & 1) == 0; + if ((!totalCarry8CountIsEven && !totalCarry10CountIsEven && totalCarry8Count + totalCarry9Count < totalCarry10Count + totalCarry11Count && totalCarryFirst32Count > 118) || + (totalCarry8CountIsEven && !totalCarry10CountIsEven && totalCarry8Count < 188 && totalCarry8Count + totalCarry9Count > totalCarry10Count + totalCarry11Count) || + (((!totalCarry8CountIsEven && !totalCarry11CountIsEven) || (totalCarry8CountIsEven && totalCarry8Count < 66) || (totalCarry8CountIsEven && totalCarry10CountIsEven && totalCarry11CountIsEven && totalCarry8Count < 72) || (!totalCarry11CountIsEven && (!totalCarry8CountIsEven || !totalCarry10CountIsEven) && totalCarry11Count > 16)) && totalCarry9Count + totalCarry11Count > totalCarry10Count + totalCarry12Count)) + { + pruneReason = CarryDropPruneReason.Dominance10AndMoreDrop; +#if WITH_PRUNE_STATS + TraceCarryDropHeuristicPrune(pLong, qExact, pruneReason, reached10, reachedBelow5, reached5, zeroCount); +#endif + return true; + } + + if (totalCarry7Count + totalCarry8Count > totalCarry9Count + totalCarry10Count && totalCarry11Count > 100) + { + pruneReason = CarryDropPruneReason.Dominance10AndMoreDrop; +#if WITH_PRUNE_STATS + TraceCarryDropHeuristicPrune(pLong, qExact, pruneReason, reached10, reachedBelow5, reached5, zeroCount); +#endif + return true; + } + + if (totalCarryAbove10 >= 840 && shortestStreakBelow10 <= 3 && + ( + (lastStreakBelow10 == 0 && first10 > 34) || + (totalCarryBelow10 < 100 && longestStreakBelow10 <= 12 && totalCarry11Count < 150 && lastStreakBelow10 < 12) + + ) + ) { pruneReason = CarryDropPruneReason.HighDensityWithShortLowStreaks; #if WITH_PRUNE_STATS