Prime Number Calculator

Quick answer

The prime number calculator tells you whether a number is prime or composite, gives its smallest prime factor, its factorisation and the nearest primes before and after it.

Result
97 is a prime number
Smallest prime factor
—
Prime factorisation
97
Previous prime
89
Next prime
101
Reason
No prime up to √97 ≈ 9.84886 divides it.

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

  1. 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.

Sources

  1. Wolfram MathWorld – Prime number
  2. OpenStax – Contemporary Mathematics

Cite this calculator

Speedy Calculator. (2026). Prime Number Calculator. Speedy Calculator. https://speedycalculator.com/calculators/math/prime-number/