From 6603f65993857fbf00fc42607f9152a5a14497ae Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sat, 27 Dec 2025 23:54:49 +0100 Subject: [PATCH] New numbers added for quick and easy reuse without struct creations. --- PerfectNumbers.Core/BigIntegerNumbers.cs | 15 +++++++++++++++ PerfectNumbers.Core/UInt128Numbers.cs | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 PerfectNumbers.Core/BigIntegerNumbers.cs diff --git a/PerfectNumbers.Core/BigIntegerNumbers.cs b/PerfectNumbers.Core/BigIntegerNumbers.cs new file mode 100644 index 0000000..984a918 --- /dev/null +++ b/PerfectNumbers.Core/BigIntegerNumbers.cs @@ -0,0 +1,15 @@ +using System.Numerics; + +namespace PerfectNumbers.Core +{ + public static class BigIntegerNumbers + { + public static readonly BigInteger OneShiftedLeft63 = BigInteger.One << 63; + public static readonly BigInteger OneShiftedLeft256MinusOne = (BigInteger.One << 256) - BigInteger.One; + public static readonly BigInteger Two = (BigInteger)2; + public static readonly BigInteger UlongMaxValue = (BigInteger)ulong.MaxValue; + public static readonly BigInteger UlongMaxValuePlusOne = UlongMaxValue + BigInteger.One; + public static readonly BigInteger UInt128MaxValue = (BigInteger)UInt128.MaxValue; + public static readonly BigInteger UInt128MaxValuePlusOne = UInt128MaxValue + BigInteger.One; + } +} \ No newline at end of file diff --git a/PerfectNumbers.Core/UInt128Numbers.cs b/PerfectNumbers.Core/UInt128Numbers.cs index f94a331..eae2c50 100644 --- a/PerfectNumbers.Core/UInt128Numbers.cs +++ b/PerfectNumbers.Core/UInt128Numbers.cs @@ -7,10 +7,11 @@ namespace PerfectNumbers.Core public static readonly UInt128 Two = 2UL; public static readonly UInt128 Three = 3UL; public static readonly UInt128 Four = 4UL; - public static readonly UInt128 SixtyFour = 64UL; + public static readonly UInt128 MaxValueMinusOne = UInt128.MaxValue - UInt128.One; public static readonly UInt128 OneHundredTwentySeven = 127UL; public static readonly UInt128 OneShiftedLeft64 = UInt128.One << 64; public static readonly UInt128 OneShiftedLeft64x2 = Two * OneShiftedLeft64; + public static readonly UInt128 SixtyFour = 64UL; public static readonly GpuUInt128 TwoGpu = new(2UL);