Skip to content
Math & Stats

Prime Number Calculator

Check if a number is prime using trial division and see its full prime factorization instantly with this free Prime Number Calculator.

Prime Number Calculator

Method

How this calculator works

A number n is prime if it is greater than 1 and has no divisor d where 2 ≤ d ≤ √n. Trial division only needs to test up to √n because any factor larger than √n would pair with a smaller factor already tested.

  1. Enter any positive whole number in the input field.
  2. The tool checks numbers less than 2 as non-prime and treats 2 and 3 as prime.
  3. For larger numbers it tests divisibility by every integer from 2 up to the square root of n.
  4. If a divisor is found the number is composite; otherwise it is prime.
  5. For composite numbers the calculator also displays the complete prime factorization.

Examples

Worked examples

Real numbers, end-to-end results.

Is 97 prime?

Prime

No divisor exists between 2 and 9 (√97 ≈ 9.8), so 97 is prime.

Factorize 360

360 = 2³ × 3² × 5

360 is composite because it has divisors other than 1 and itself.

Is 1 prime?

Not prime

1 has only a single divisor, so it fails the definition of a prime.

Use cases

When to use it

  • Verifying primality for cryptography and RSA key generation coursework.
  • Simplifying fractions by finding shared prime factors.
  • Checking homework and competition math answers quickly.
  • Teaching the fundamental theorem of arithmetic with worked factorizations.

FAQ

Frequently asked questions

What is a prime number?
A prime number is a whole number greater than 1 that has exactly two distinct divisors: 1 and itself. Examples include 2, 3, 5, 7, and 11.
Is 1 a prime number?
No. By definition a prime must have exactly two distinct positive divisors. The number 1 has only one divisor (itself), so it is neither prime nor composite.
Why is 2 the only even prime?
Every even number greater than 2 is divisible by 2 in addition to 1 and itself, giving it more than two divisors. That makes 2 the only even prime number.
How does the calculator test for primality?
It uses trial division, checking for divisors only up to the square root of the number. If no divisor is found in that range, the number is prime.
What is prime factorization?
Prime factorization expresses a composite number as a product of prime numbers, such as 360 = 2³ × 3² × 5. Every integer greater than 1 has a unique prime factorization.