isprime

Checks if a number is prime using the probabilistic Miller-Rabin test.

Syntax

isprime(value, iterations?)

Parameters

Return value

true if the value is probable prime, false otherwise.

If the result is true, the probability that the value is not prime is at least $1 - 0.5^{iterations}$.

Examples

isprime(2147483647)
true
isprime(10)
false