[−][src]Function prime_check::prime_check
pub fn prime_check(n: u64, k: u32) -> bool
Implementation of Fermat Prime Test. Returns true if the number is probably prime, false if it is composite. This is exposed to JavaScript.
Arguments
n
- Rustu64
; JSBigInt
; The number to test.k
- Rustu32
; JSNumber
; Number of time to run the test. Improves accuracy of result.
Example
// remember that the first argument needs to be a BigInt, hence the 'n' at
// the end. Could also use `BigInt(5)`.
var result = module.prime_check(5n, 10);