Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

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

  • 97 prime?=true⁡\displaystyle 97 \text{ prime?} = \operatorname{true}
    is_prime(97)

    In the solver, is_prime(97) gives true.

    Open in the solver
  • 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.