int_math library
A collection of common mathematical functions on integers.
Functions

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 amongn
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.

isProbablyPrime(
int n) → bool 
Tests if the number
n
is probably a prime. [...] 
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.

polynomial(
Iterable< num> cs, [ num x = 10 ]) → num 
Evaluates the polynomial described by the given coefficients
cs
and the valuex
. [...] 
pow(
num x, int y) → num 
Returns the power
x
raised toy
, wherey
is an int. 
powMod(
int x, int y, int m) → int 
Returns the power
x
raised toy
modulom
, wherex
,m
andy
are ints. 
primesUpTo(
int limit) → List< int> 
Returns primes up to a
limit
computed by the Sieve of Eratosthenes.