StatGardenREF. DESK
Calculators/Maths/Prime check & factorisation
Maths

Prime check & factorisation calculator

Tests primality and lists the prime factors.

What this calculator does

Every whole number above one is either prime or a unique product of primes. That uniqueness is the fundamental theorem of arithmetic, and it makes prime factorisation the natural way to understand a number’s structure: its divisors, its common factors with other numbers, and how it behaves in fractions.

This calculator tests primality by trial division and returns the complete factorisation along with the count and sum of all divisors. Both of those follow directly from the factorisation rather than needing the divisors to be listed out.

The formula

FormulaTrial division by every integer up to √n; n is prime if none divides it

Trial division tests each integer from 2 upward, dividing out any factor found and repeating until the remainder cannot be divided further. Testing only up to the square root is sufficient, because any factor above it must pair with one below.

TermMeaning
PrimeA number greater than 1 whose only divisors are 1 and itself.
Prime factorisationThe unique set of primes whose product is the number.
DivisorAny number that divides evenly with no remainder.
Exponent formThe factorisation written with repeated primes as powers.

The inputs explained

FieldWhat to enter
Whole numberA whole number. Very large values will take longer, since trial division tests every integer up to the square root.

When to use it

Simplifying fractions

Factorising numerator and denominator makes the shared factors visible, which is the manual route to lowest terms.

Finding all the divisors

The divisor count comes straight from the exponents in the factorisation: add one to each and multiply. That is far faster than testing every candidate.

Understanding why some numbers are convenient

60 has twelve divisors, which is why it underpins minutes, seconds and degrees. Highly composite numbers divide neatly in many ways, and that is why they were chosen.

Checking primality

Useful in number theory work and as a sanity check. Cryptographic applications use enormous primes and probabilistic tests rather than trial division, but the principle is the same.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

Factorisation of some interesting numbers

A range of numbers chosen to show different factorisation patterns.

Structure of common numbers
NumberIs it prime?Prime factorsExponent formNumber of divisors
60No2 × 2 × 3 × 52^2 × 3 × 512
97Yes97972
100No2 × 2 × 5 × 52^2 × 5^29
128No2 × 2 × 2 × 2 × 2 × 2 × 22^78
360No2 × 2 × 2 × 3 × 3 × 52^3 × 3^2 × 524
5,040No2 × 2 × 2 × 2 × 3 × 3 × 5 × 72^4 × 3^2 × 5 × 760
5040 has sixty divisors, which is extraordinary for its size: it is seven factorial, and Plato reportedly favoured it as an ideal city population for exactly that divisibility.

Powers of two versus highly composite numbers

Numbers of similar size with very different divisor structures.

Comparing divisor counts
NumberPrime factorsNumber of divisorsSum of divisors
642 × 2 × 2 × 2 × 2 × 27127
962 × 2 × 2 × 2 × 2 × 312252
1002 × 2 × 5 × 59217
1202 × 2 × 2 × 3 × 516360
1282 × 2 × 2 × 2 × 2 × 2 × 28255
1442 × 2 × 2 × 2 × 3 × 315403
128 is larger than 120 but has only eight divisors against sixteen, because all its factors are the same prime. Divisor count depends on the variety of primes, not the size of the number.

Questions

Is 1 a prime number?

No. Primes are defined as having exactly two distinct divisors, and 1 has only one. Excluding it is what keeps prime factorisation unique: otherwise any factorisation could have any number of 1s appended.

How do I find prime factors by hand?

Divide by the smallest prime that goes in evenly, then repeat on the quotient. Start with 2, then 3, 5, 7 and so on. Stop when the remaining number is prime.

How many divisors does a number have?

Add one to each exponent in the prime factorisation and multiply. For 360 = 2³ × 3² × 5, that is 4 × 3 × 2 = 24 divisors.

What is the largest known prime?

It changes as new ones are discovered, and the record has stood in the tens of millions of digits for some years. They are found by distributed computing projects searching a particular form of number, and cannot be verified by trial division.

Why do primes matter in cryptography?

Multiplying two large primes is easy; recovering them from the product is computationally hard. Several widely used encryption schemes rest on that asymmetry.

For common factors between numbers, see GCD and LCM. For counting arrangements, try permutations and combinations.