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
02 / result
IS IT PRIME?
Yes — prime
- Prime?
- Yes
- Smallest factor
- —
- Cofactor
- —
Calculation trace
- no divisor found from 2 to √9797Result
Maintained by Jack Shi
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.
Verified runs
Synthetic examples executed at build revision 9e21499 on . Cards round decimal results to 6 significant figures; matching uses full precision and the tolerance below. Matches cover the displayed fields, not every possible input or clinical or engineering validation.
Inputs: Integer: 97 integer
Result: Prime: true boolean (expected Prime: true boolean) ✓
Inputs: Integer: 1 integer
Result: Prime: false boolean (expected Prime: false boolean) ✓
Inputs: Integer: 91 integer
Result: Prime: false boolean; Smallest factor: 7 (expected Prime: false boolean; Smallest factor: 7) ✓
How these runs were checked
Method: prime-checker@1.0.0. Expectations come from the listed test fixtures or hand arithmetic; they are not copied from these executions. Omitted optional inputs use the method defaults. Run dates record execution, not expert review or fresh measurements.
Download all verified runs (JSON) — full inputs, returned values, expectations, timestamps and buildRevision.
- normal: . Absolute tolerance: 1e-10. Text and booleans match exactly. Full-precision result: Prime: true boolean. Expected: Prime: true boolean. Expectation: packages/calculator-core/tests/prime-checker.test.ts
- boundary: . Absolute tolerance: 1e-10. Text and booleans match exactly. Full-precision result: Prime: false boolean. Expected: Prime: false boolean. Expectation: packages/calculator-core/tests/prime-checker.test.ts
- sensitivity: . Absolute tolerance: 1e-10. Text and booleans match exactly. Full-precision result: Prime: false boolean; Smallest factor: 7. Expected: Prime: false boolean; Smallest factor: 7. Expectation: packages/calculator-core/tests/prime-checker.test.ts
Reproduce from the source checkout with pnpm --filter @sumivo/web gen:verified-runs. A rebuild changes execution times; the revision identifies its Git starting point, including any uncommitted changes made for that build.
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 UniversityPrealgebra 2e ↗
Prime numbers and divisibility
Accessed 2026-09-02