Math / Prime Number Checker

Prime Number Checker

Check whether a whole integer is prime. Values below 2 are correctly identified as not prime.

Exact deterministic checks are supported through the unsigned 64-bit maximum.

Your answer will appear here.

Formula: A prime number is an integer greater than 1 with no positive divisors other than 1 and itself.

The basics

What makes a number prime

A prime number is a whole number greater than 1 whose only positive divisors are 1 and itself. Everything else above 1 is composite, because it can be written as a product of smaller factors. Numbers below 2 are neither prime nor composite.

Testing uses a deterministic Miller–Rabin routine proven correct across the full unsigned 64-bit range, so even very large values are checked exactly. For the divisors behind a number, the GCD & LCM calculator works with them directly.

How the formula works

prime ⇔ n > 1 and no divisor d with 1 < d ≤ √n

You only need to test divisors up to the square root of n; any larger factor would pair with one below it.

2 is prime

It is the only even prime number.

Large values

Exact checks are supported up to 2⁶⁴ − 1.

In practice

Worked examples

Input

97

Answer

Prime

Input

1

Answer

Not prime

Good to know

Frequently asked questions

No. Prime numbers are integers greater than 1 with exactly two positive divisors. Values below 2 are marked not prime.

Keep going