Education

How to Tell if a Number Is Prime (with a Worked Example)

ToolOrbit Team 2 min readUpdated
How to Tell if a Number Is Prime (with a Worked Example)

A prime number is a whole number greater than 1 that has exactly two divisors: 1 and itself. Primes are the building blocks of arithmetic, the foundation of encryption, and a favorite topic in math class. The Prime Number Checker tells you instantly whether a number is prime, and if it is not, it shows the prime factorization and every divisor.

How primality testing works

To decide if a number n is prime, you only need to test for divisors up to the square root of n. If no whole number from 2 up to that square root divides n evenly, then n is prime. This shortcut works because any factor larger than the square root must pair with one smaller than it, which you would already have found.

  • 0 and 1 are not prime; primes are defined as greater than 1.
  • 2 is the only even prime; every other even number is divisible by 2.
  • A composite number has at least one divisor other than 1 and itself.
  • Prime factorization expresses a number as a product of primes, and that product is unique for every integer above 1.

Testing whether a number is prime

Enter a positive whole number and read the verdict. For a prime, the tool confirms it has no factors beyond 1 and itself. For a composite, it breaks the number into its prime factors and lists the complete set of divisors. All of this happens locally in your browser, with no number ever leaving your device.

A worked example

Take 84. It is even, so 2 divides it, giving 42. Then 2 divides 42 to give 21, then 3 divides 21 to give 7, which is prime. So the prime factorization is 2 times 2 times 3 times 7, often written 2 squared times 3 times 7. From those factors the tool builds the full divisor list: 1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 42, and 84.

Now try 97. Its square root is just under 10, so you test 2, 3, 5, and 7. None divide 97 evenly, so it is prime and its only divisors are 1 and 97.

Watching the prime factorization appear is the fastest way to understand why a number behaves the way it does in fractions, ratios, and least common multiples.

Where primes matter

Beyond the classroom, prime factorization underpins reducing fractions, finding greatest common divisors, and modern cryptography, which relies on the difficulty of factoring very large numbers. The Prime Number Checker makes the small-scale version of that problem transparent, turning an abstract definition into a concrete list of factors you can inspect.


Tools mentioned

More reading

View all guides
How to Write Numbers in Words: Rules and Examples
Education

How to Write Numbers in Words: Rules and Examples

How numbers are spelled out in English: three-digit groups, scale words such as thousand and million, hyphens, and a worked example.

2 min readUpdated
How Roman Numerals Work: Symbols, Rules and Examples
Education

How Roman Numerals Work: Symbols, Rules and Examples

The seven Roman numeral symbols, the subtraction rule behind IV and IX, which forms are invalid, and a worked example.

2 min readUpdated
How to Calculate Mean, Median and Mode (Worked Example)
Education

How to Calculate Mean, Median and Mode (Worked Example)

How to work out the mean, median and mode by hand, with a worked example and guidance on which measure to report.

2 min readUpdated
How to Learn the Times Tables: Which Facts to Learn First
Education

How to Learn the Times Tables: Which Facts to Learn First

How a times table is built, a worked example, and an order for learning the multiplication facts that makes them quicker to remember.

2 min readUpdated
How to Calculate Weighted GPA on the 4.0 Scale
Education

How to Calculate Weighted GPA on the 4.0 Scale

The 4.0 grade point scale, how Honors and AP weighting changes the result, and a worked example.

2 min readUpdated
Mean vs Median vs Mode: Which Average Should You Use?
Education

Mean vs Median vs Mode: Which Average Should You Use?

They are all called "the average", but they answer different questions — and using the wrong one can badly mislead. Here is how to choose, with worked examples.

2 min readUpdated
What Is Base64? How Encoding Works and Common Mistakes
Developer

What Is Base64? How Encoding Works and Common Mistakes

What Base64 encoding actually does, where it is used, and the mistakes that cause broken or oversized output.

2 min readUpdated
encodeURI vs encodeURIComponent: Which One to Use
Developer

encodeURI vs encodeURIComponent: Which One to Use

How percent-encoding works, the difference between encoding a whole URL and a single component, and the mistakes that break links.

2 min readUpdated