Prime numbers and factorisation
Check whether a number is prime and break it down into its prime factors.
Calculator inputs
Results
Enter your values and press “Calculate” to see the result.
In short
- What it calculates
- Check whether a number is prime and break it down into its prime factors.
- Formula used
n = p₁^a₁ · p₂^a₂ · … · pₖ^aₖ- Example
- 360 = 2³ × 3² × 5
Prime number checker
A prime number has exactly two divisors: one and itself. Every other number can be written uniquely as a product of primes.
The tool tests primality and shows the full factorisation.
How it works
Divisors are tested from 2 up to the square root of the number, dividing whenever the division is exact. Whatever remains at the end, if greater than one, is prime as well.
The divisor count follows from the exponents in the factorisation.
Formula
n = p₁^a₁ · p₂^a₂ · … · pₖ^aₖ
Number of divisors: (a₁ + 1) · (a₂ + 1) · … · (aₖ + 1)
Worked example
360 = 2³ × 3² × 5
Divisors: (3+1) × (2+1) × (1+1) = 24
It is not prime because it has more than two divisors.
Explanation
One is not prime, and there is a reason
A prime number has exactly two distinct divisors: one and itself. The number one has only one, so it falls outside by definition. It is not arbitrary: if one were prime, prime factorisation would stop being unique, because you could add as many ones as you liked. All of arithmetic rests on that uniqueness.
They are infinite, and Euclid proved it
The proof is over two thousand years old and remains elegant: if there were only finitely many primes, multiplying them all together and adding one would produce a number divisible by none of them, contradicting the premise.
From curiosity to infrastructure
For centuries they were an intellectual game with no application. Today the security of communications depends on them: encrypting is easy by multiplying two enormous primes, and decrypting without the key would require factorising the product, something no classical computer can do in reasonable time.
They thin out but never run out
The further you go, the further apart they are, but they never stop appearing. The largest known has tens of millions of digits and is found through distributed computing projects.
Frequently asked questions
Is 1 a prime number?
No. By convention 1 is not prime, because allowing it would break the uniqueness of prime factorisation.
How large a number can it handle?
Up to 2,000,000,000. Beyond that, trial division would take too long in a browser.
Why is 1 not considered prime?
Because a prime must have exactly two distinct divisors and one has only one. Including it would also break the uniqueness of prime factorisation.
What are prime numbers used for today?
They underpin public key cryptography. The security of encrypted communications rests on the difficulty of factorising the product of two large primes.
Need to calculate something else?
These tools are often used alongside this calculator.
GCD
Find the GCD of two or more whole numbers using Euclid’s algorithm.
LCM
Compute the LCM of several numbers to add fractions or synchronise repeating cycles.
Fractions
Add, subtract, multiply or divide two fractions and get the result already simplified.
Calculator
Type the whole expression and get the result instantly, brackets and functions included.
Percentage
The four most common percentage calculations in a single tool.
Scientific
Trigonometry, logarithms, exponentials and factorials, with a degrees/radians switch.