Primality test (is_prime)
Test whether a whole number is prime.
How to write it
is_prime(n)
- n
- The number to test. Takes a whole number.
Examples
is_prime(97)In the solver,
Open in the solveris_prime(97)givestrue.
Related functions
- is_prime_power
Test whether a whole number is a power of a prime.
- next_prime
The least prime greater than a number.
- nth_prime
The n-th prime, counting 2 as the first.
- previous_prime
The greatest prime less than a number.
- prime_nu
How many distinct primes divide a whole number.
- prime_omega
How many primes divide a whole number, counted with multiplicity.