Other minor dependencies updates in 7.1.x patch

This commit is contained in:
Christopher J. Brody
2018-11-22 09:57:22 -05:00
parent d918c7a83c
commit 5a5f544a48
18 changed files with 401 additions and 237 deletions
+5 -5
View File
@@ -219,15 +219,15 @@ Returns `true` if the number is prime, `false` otherwise.
Returns `true` if the number is very likely to be prime, `false` otherwise.
Argument is optional and determines the amount of iterations of the test (default: `5`). The more iterations, the lower chance of getting a false positive.
This uses the [Fermat primality test](https://en.wikipedia.org/wiki/Fermat_primality_test).
This uses the [Miller Rabin test](https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test).
- `bigInt(5).isProbablePrime()` => `true`
- `bigInt(49).isProbablePrime()` => `false`
- `bigInt(1729).isProbablePrime(50)` => `false`
- `bigInt(1729).isProbablePrime()` => `false`
Note that this function is not deterministic, since it relies on random sampling of factors, so the result for some numbers is not always the same. [Carmichael numbers](https://en.wikipedia.org/wiki/Carmichael_number) are particularly prone to give unreliable results.
For example, `bigInt(1729).isProbablePrime()` returns `false` about 76% of the time and `true` about 24% of the time. The correct result is `false`.
Note that this function is not deterministic, since it relies on random sampling of factors, so the result for some numbers is not always the same.
If the number is composite then the MillerRabin primality test declares the number probably prime with a probability at most `4` to the power `iterations`.
If the number is prime, this function always returns `true`.
#### `isUnit()`