int_math library

A collection of mathematical functions on ints.


binomial(int n, int k) int
Returns the binomial coefficient of the arguments. This is the number of ways, disregarding order, that k objects can be chosen from among n objects.
factorial(int n) int
Returns the factorial of the argument. This is the number of ways to arrange n distinct objects into a sequence.
gcd(int a, int b) int
Returns the greatest common divisor (GCD) of two or more integers (at least one of which is not zero). This is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4.
lcm(int a, int b) int
Returns the least common multiple (LCM) of two integers a and b. This is the smallest positive integer that is divisible by both a and b.
pow(num x, int n) num
Returns the power x raised to n, where n is an int.
primesUpTo(int limit) List<int>
Returns primes up to a limit compued by the Sieve of Eratosthenes.