Sumivo · Mathematics

Prime Number Checker

Test whether a whole number is prime — divisible only by 1 and itself — using trial division, and see the smallest factor when it is not.

01 / inputs

integer

02 / result

IS IT PRIME?

Yes — prime

Prime?
Yes
Smallest factor
Cofactor

Calculation trace

  1. no divisor found from 2 to √97
    97
    Result
§

How it works

A prime number is an integer greater than 1 whose only divisors are 1 and itself. The tool uses trial division: it checks whether the number is divisible by 2, then by each odd number 3, 5, 7, … up to its square root. If any of these divides evenly, the number is composite and that divisor is its smallest factor; if none does, the number is prime. Testing only up to the square root is enough, because any factor larger than √n must pair with a factor smaller than √n.

Assumptions & limits

  • A prime is an integer greater than 1; 1, 0, and negative numbers are reported as not prime.
  • For a composite number the tool reports the smallest prime factor and its cofactor.
  • Inputs are capped at 1,000,000,000,000 so the check stays fast in the browser.
§

FAQ

What is a prime number?
An integer greater than 1 that has no positive divisors other than 1 and itself. The first few primes are 2, 3, 5, 7, 11, and 13.
Is 1 a prime number?
No. 1 has only one divisor — itself — while a prime must have exactly two distinct divisors, 1 and the number. 1 is neither prime nor composite.
Is 2 a prime number?
Yes. 2 is divisible only by 1 and 2, which makes it prime — and it is the only even prime, because every other even number is divisible by 2.
How does the checker know a number is prime?
It tries to divide the number by every candidate from 2 up to its square root. If nothing divides evenly, no factor exists, so the number is prime. Checking only to the square root is sufficient and keeps it fast.
What is the difference between prime and composite?
A prime has exactly two divisors (1 and itself); a composite number greater than 1 has at least one more. For example 7 is prime, while 9 is composite because 3 divides it.
§

Related calculators

§

SOURCES

  • OpenStax, Rice University
    Prealgebra 2e

    Prime numbers and divisibility

    Accessed 2026-09-02