-
Notifications
You must be signed in to change notification settings - Fork 1
Basic math
Here is an implementation of basic mathematical methods to work with integers.
-
GetPrime- finds a prime number starting from the one specified by theminparameter and has the following signature:Methods
public static TNumber GetPrime(TNumber min)
-
IsPrime- returns a flag indicating whether the specified number in the parameter is a prime number and has the following signature:Methods
public static bool IsPrime(TNumber number)
-
Gcd(Greatest common divisor) - returns the gcd value of two integers and has the following signature:Methods
public static TNumber Gcd(TNumber a, TNumber b)
-
Lcm(Least common multiple) - returns the lcm value of two integers and has the following signature:Methods
public static TNumber Lcm(TNumber a, TNumber b)
-
Pow(Power) - returns the value specified by thenumberparameter of the method raised to the power specified by thepowerparameter and has the following signature:Methods
public static TNumber Pow(TNumber number, int power)
-
Sqrt(Square root) - returns the square root of the integer specified in the method parameter and has the following signature:Methods
public static TNumber Sqrt(TNumber number)
-
Root(Nth root) - returns the N-th root of the integer specified bynumberparameter and degree integer specified bypowerparameter and has the following signature:Methods
public static TNumber Root(TNumber number, int power)
-
Log(Logarithm) - returns the logarithm of the integer specified bynumberparameter to the base integer specified bybaseparameter and has following signature:Methods
public static int Log(TNumber number, TNumber @base)
Methods
public static IEnumerable<TNumeral> FactorialSequence(TNumeral number);
public static IEnumerable<TNumeral> RisingFactorialSequence(TNumeral number, int power);
public static IEnumerable<TNumeral> FallingFactorialSequence(TNumeral number, int power);Methods
public static TNumeral Factorial(TNumeral number);
public static TNumeral RisingFactorial(TNumeral number, int power);
public static TNumeral FallingFactorial(TNumeral number, int power);Methods
public static TNumeral Factorial(TNumeral number, int degreeOfParallelism, CancellationToken cancellationToken = default);
public static TNumeral RisingFactorial(TNumeral number, int power, int degreeOfParallelism, CancellationToken cancellationToken = default);
public static TNumeral FallingFactorial(TNumeral number, int power, int degreeOfParallelism, CancellationToken cancellationToken = default);Methods
public static double ApproxFactorial(TNumeral number);
public static double RisingApproxFactorial(TNumeral number, int power);
public static double FallingApproxFactorial(TNumeral number, int power);Methods
public static IEnumerable<Factor<TNumeral>> Factorize(TNumeral number);
public static IEnumerable<Factor<TNumeral>> Factorize(this IEnumerable<TNumeral> numbers);
public static IEnumerable<Factor<TNumeral>> Factorize(this IEnumerable<TNumeral> numbers, int degreeOfParallelism, CancellationToken cancellationToken = default);Methods
public static TNumeral Product(this IEnumerable<Factor<TNumeral>> factors);
public static TNumeral Product(this IEnumerable<Factor<TNumeral>> factors, int degreeOfParallelism, CancellationToken cancellationToken = default);Methods
public static IEnumerable<Factor<TNumeral>> Mul(this IEnumerable<Factor<TNumeral>> multiplicand, IEnumerable<Factor<TNumeral>> multiplier);
public static IEnumerable<Factor<TNumeral>> Div(this IEnumerable<Factor<TNumeral>> dividend, IEnumerable<Factor<TNumeral>> divider);
public static IEnumerable<Factor<TNumeral>> Pow(this IEnumerable<Factor<TNumeral>> factors, int power);