CalcWorldHub
Free online calculator · no signup

Prime number checker

Check whether an integer is prime and see its status as a prime, composite, or special value.

4,000 tools
Prime number checker — Integer to check and calculation method
Prime number checker: inputs and calculation method.

How to use this calculator

Check whether an integer is prime and see its status as a prime, composite, or special value.

  1. Enter Integer to check. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Math guide

How this calculation works

p?
A visual cue for the quantities used in this calculation.

This guide follows prime number checker from its stated formula through a worked example, then identifies the assumptions that bound the result.

Inputs and meanings

number — Integer to check
Enter a whole number from −10,000,000,000 to 10,000,000,000.

Formula and method

For n ≥ 2, test divisors d from 2 through ⌊√n⌋. If none divides n, then n is prime.

A composite integer has a divisor no larger than its square root, so trial division does not need to test every smaller integer.

Worked example

Check whether an integer is prime and see its status as a prime, composite, or special value.

For 97, test possible divisors through ⌊√97⌋ = 9. None of 2 through 9 divides 97, so 97 is prime.

Assumptions and limits

This browser calculator uses trial division and limits the input to 10¹⁰ so the check completes promptly. Zero, one, and negative integers are neither prime nor composite.

Frequently asked questions

Is 1 a prime number?

No. A prime number is an integer greater than 1 with exactly two positive divisors.

Why only test divisors up to the square root?

If n has a factor greater than its square root, its paired factor must be smaller than the square root.

Does this find the prime factorization?

No. It classifies the input. Use the prime factorization calculator to list its prime factors.

How do I use the Prime number checker?

Enter Integer to check. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Prime number checker?

Check whether an integer is prime and see its status as a prime, composite, or special value. For 97, test possible divisors through ⌊√97⌋ = 9. None of 2 through 9 divides 97, so 97 is prime.