Math

Prime Number Checker

Check if a number is prime.

CALCULATOR

Enter your numbers

Instant results

THE NUMORIX GUIDE

How to use the Prime Number Checker

Last reviewed September 14, 2026

What this calculator does

Reject numbers below 2, handle 2, reject even values, then test odd divisors from 3 through sqrt(n).

Formula and method

Reject numbers below 2, handle 2, reject even values, then test odd divisors from 3 through sqrt(n). A divisor pair proves compositeness; reaching sqrt(n) without one proves primality.

Variables and inputs

Number defaults to 17 and is parsed as an integer. The output is a prime/not-prime label, a small factor list, and an explanatory step.

Worked example

For 17, sqrt(17) is about 4.12, so test 2 and 3; neither divides 17, so 17 is prime. For comparison, 91 is divisible by 7 and is not prime.

How to interpret the result

A prime has exactly two positive integer divisors, 1 and itself. Testing only through the square root is sufficient because larger factors would pair with a smaller factor.

Common mistakes to avoid

Do not label 1 prime; it has only one positive divisor. Do not stop after checking only whether the number is odd.

Assumptions and limitations

The engine parses the UI input with parseInt, so decimal text is truncated by the caller. It returns only the first factor pair found for a composite number, not a complete factorization.

Practical use and checks

The Prime Checker tests whether an integer greater than 1 has any divisor other than 1 and itself. Enter 17 as a check; it should be marked prime after testing possible divisors through the square root, which is about 4.12. Enter 91 as a contrasting check; the calculator should find 7 as a factor and mark it composite because 91 equals 7 x 13. Entering 1 should not produce prime, since 1 has only one positive divisor. The square-root stopping rule is efficient: if a composite number has a factor pair, at least one factor is no larger than its square root. Use the result for learning, small integer checks, or a preprocessing step, but do not treat it as a full factorization service. The input is parsed as an integer, so decimal text can be truncated by the caller and malformed text can be misleading. Negative numbers, zero, and very large integers require explicit handling outside the ordinary positive-integer use case. The output may report the first factor pair rather than every prime factor, so a composite label does not tell you its complete structure. For cryptographic or security work, use a vetted arbitrary-precision primality library with documented probabilistic or deterministic guarantees.

Sources and references

COMMON QUESTIONS

Frequently asked questions

Why is 1 not prime?

A prime must have exactly two distinct positive divisors; 1 has only itself.

Why stop at the square root?

If n = a*b and both factors exceeded sqrt(n), their product would exceed n, so at least one factor must be at or below sqrt(n).