Primes are the atoms of arithmetic: numbers greater than 1 divisible only by 1 and themselves. Testing primality is easy even for big numbers, while factoring them is hard – the asymmetry behind modern cryptography.
How to use the Prime Number Calculator
- Number
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
The calculator uses trial division by small primes and the deterministic Miller–Rabin test, which is exact for every number you can type, then finds the neighbouring primes.
Formula
n is prime ⇔ n > 1 and no prime p ≤ √n divides n
Worked example
Inputs — Number: 97.
Results — Result = 97 is a prime number; Prime factorisation = 97; Previous prime = 89; Next prime = 101; Reason = No prime up to √97 ≈ 9.84886 divides it..
Key terms
- Prime number
- A number > 1 whose only divisors are 1 and itself.
- Composite number
- A number > 1 that is not prime.
Frequently asked questions
Is 1 prime?
No – primes must have exactly two divisors.
Is 2 prime?
Yes, and it is the only even prime.
How many primes are there?
Infinitely many (Euclid's theorem).
What is the largest known prime?
A Mersenne prime with tens of millions of digits, found by the GIMPS project.