a collection of math-related functions

a collection of math-related functions

```
npm install mathutils
```

Check if the bit for `2^0`

is set. If it is, `n must be odd.

powermod is a way of computing `(a ^ b) mod c`

without having to deal with giant numbers that would loose their precision.

Returns if `n`

is a prime. Extremely slow, but absolutely accurate.

Retuns if a `n`

is a prime. Based upon Fermat's little theorem.

Note: Doesn't take care of carmichael primes, so you probably want to use this in combination with slowIsPrime.

Runs both `fastIsPrime`

and `slowIsPrime`

. This way, it manages to be both (relatively) fast and accurate.

Returns a pseudo-random prime number (based on `Math.random`

). `length`

defaults to 3.

Returns the greatest common divisor of `a`

and `b`

. Based on Euclids algorithm

Computes the extended Euclidean algorithm. Returns an array `[d, s, t]`

.

```
gcd(a, b) = d = s * a + t * b
```

Returns the modular multiplicative inverse of `a`

and `b`

.

- write tests
- add more documentation
- learn how to breakdance