diff --git a/csharp/Platform.Numbers.Benchmarks/MathBenchmarks.cs b/csharp/Platform.Numbers.Benchmarks/MathBenchmarks.cs index 77a4dbd..3738c55 100644 --- a/csharp/Platform.Numbers.Benchmarks/MathBenchmarks.cs +++ b/csharp/Platform.Numbers.Benchmarks/MathBenchmarks.cs @@ -194,12 +194,6 @@ public static ulong FactorialWhileLoopWithoutArrayAndCountingArrayLength(ulong n } private const ulong FactorialNumber = 19; - [Benchmark] - public ulong CurrentFactorialImplementation() - { - return Math.Factorial(FactorialNumber); - } - [Benchmark] public ulong FactorialUsingStaticArrayAndRecursionWithContantAsMaximumN() { diff --git a/csharp/Platform.Numbers/Math.cs b/csharp/Platform.Numbers/Math.cs index 84a48b7..41987c1 100644 --- a/csharp/Platform.Numbers/Math.cs +++ b/csharp/Platform.Numbers/Math.cs @@ -11,12 +11,6 @@ namespace Platform.Numbers /// Resizable array (FileMappedMemory) for values cache may be used. or cached oeis.org public static class Math { - private static readonly ulong[] _factorials = - { - 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, - 479001600, 6227020800, 87178291200, 1307674368000, 20922789888000, - 355687428096000, 6402373705728000, 121645100408832000, 2432902008176640000 - }; private static readonly ulong[] _catalans = { 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, @@ -26,42 +20,12 @@ public static class Math 14544636039226909, 55534064877048198, 212336130412243110, 812944042149730764, 3116285494907301262, 11959798385860453492 }; - /// - /// Represents the limit for calculating the catanal number, supported by the type. - /// Представляет предел расчёта катаналового числа, поддерживаемый типом. - /// - public static readonly ulong MaximumFactorialNumber = 20; - /// /// Represents the limit for calculating the factorial number, supported by the type. /// Представляет предел расчёта факториала числа, поддерживаемый типом. /// public static readonly ulong MaximumCatalanIndex = 36; - /// - /// Returns the product of all positive integers less than or equal to the number specified as an argument. - /// Возвращает произведение всех положительных чисел меньше или равных указанному в качестве аргумента числу. - /// - /// - /// The maximum positive number that will participate in factorial's product. - /// Максимальное положительное число, которое будет участвовать в произведении факториала. - /// - /// - /// The product of all positive integers less than or equal to the number specified as an argument. - /// Произведение всех положительных чисел меньше или равных указанному, в качестве аргумента, числу. - /// - public static TLinkAddress Factorial(TLinkAddress n) where TLinkAddress : IUnsignedNumber, IComparisonOperators - { - if (n >= TLinkAddress.Zero && n <= TLinkAddress.CreateTruncating(MaximumCatalanIndex)) - { - return TLinkAddress.CreateTruncating(_factorials[ulong.CreateTruncating(n)]); - } - else - { - throw new ArgumentOutOfRangeException($"Only numbers from 0 to {MaximumFactorialNumber} are supported by unsigned integer with 64 bits length."); - } - } - /// /// Returns the Catalan Number with the number specified as an argument. /// Возвращает Число Катанала с номером, указанным в качестве аргумента.