Prime numbers, factors and divisors explained
Reviewed 23 November 2026 · 7 min read · Written and maintained by Toolnexo
Prime numbers are the building blocks of whole numbers, and a few simple ideas about them explain divisors, fractions and a good part of how encryption works. This guide covers what a prime is, how to test one by hand, how to break a number into prime factors, how to read off its divisors, and how the same factors give the greatest common divisor and the least common multiple. The figures come from the prime number checker on this site, which runs in your browser, so the numbers you enter are not uploaded.
What a prime is
A prime is a whole number greater than 1 whose only divisors are 1 and itself. The first ones are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. A number with other divisors is called composite. The number 1 is neither: it has only one divisor, and leaving it out keeps factorisation unique. The number 2 is the only even prime, because every other even number is divisible by 2.
Testing a number by hand
To test n, try dividing it by the whole numbers from 2 up to its square root. If none divides it evenly, it is prime. You can stop at the square root because a factor larger than that would need a partner smaller than it, and you would have found the partner already.
For 97, the square root is about 9.85, so you test 2, 3, 5 and 7. None divides 97, so it is prime. The next prime is 101 and the one before is 89. Some numbers look prime and are not: 91 is 7 × 13, and 2047, which is 2 to the power 11 minus 1, is 23 × 89. Another is 561 = 3 × 11 × 17, which fools the simple Fermat test. Trying real divisors is slower but cannot be fooled.
Why the checker only tries some divisors
Every prime above 3 has the form 6k − 1 or 6k + 1, because any other number of that size is divisible by 2 or 3. So after trying 2 and 3, the checker tries only 5, 7, 11, 13, 17 and so on, a third of all candidates. For a number near 10^15, the square root is 31,622,776, which means about 10.5 million divisions, quick enough to finish in a fraction of a second in a browser. This is why the tool accepts numbers up to 10^15 and no larger.
Prime factorisation
Every whole number above 1 is a product of primes in exactly one way, apart from the order. For 360, divide by 2 three times to get 45, by 3 twice to get 5, and 5 is prime: 360 = 2³ × 3² × 5. For 561 the factors are 3 × 11 × 17. A prime is its own factorisation.
The checker shows the factors with their powers and lets you copy them in plain text as 2^3 x 3^2 x 5.
From factors to divisors
The factors tell you how many divisors a number has without listing them. Add 1 to each exponent and multiply: for 360 = 2³ × 3² × 5, that is (3 + 1) × (2 + 1) × (1 + 1) = 24 divisors. Their sum is (1 + 2 + 4 + 8) × (1 + 3 + 9) × (1 + 5) = 15 × 13 × 6 = 1,170. A prime has exactly two divisors, 1 and itself.
A number whose divisors, other than itself, add up to the number is called perfect. The first two are 6, with 1 + 2 + 3 = 6, and 28, with 1 + 2 + 4 + 7 + 14 = 28.
GCD and LCM from the factors
Write both numbers as products of primes. The greatest common divisor takes the lowest power of each prime they share, and the least common multiple takes the highest power of every prime in either. Take 360 = 2³ × 3² × 5 and 84 = 2² × 3 × 7. The GCD is 2² × 3 = 12. The LCM is 2³ × 3² × 5 × 7 = 2,520. A check: 12 × 2,520 = 30,240, which is 360 × 84.
The GCD is what you divide by to simplify a fraction, and the LCM is the common denominator when you add fractions.
How common are primes
- There are 25 primes below 100, 168 below 1,000, 9,592 below 100,000 and 78,498 below 1,000,000. They thin out, but they never run out.
- Twin primes are pairs that differ by 2, such as 3 and 5, 11 and 13, 17 and 19, 29 and 31, and 41 and 43.
- 1,000,000,007 is prime. 999,999,999,989 is the largest prime below 1,000,000,000,000, and the next prime after it is 1,000,000,000,039.
- Encryption such as RSA uses primes hundreds of digits long. Multiplying two of them is easy, and factoring the product is far beyond what trial division can do.
Using the checker
- Type a whole number from 0 to 10^15 to see whether it is prime, its factors, its divisors and its neighbouring primes.
- Type a limit up to 1,000,000 to list every prime up to it. The page shows the first 2,000 and the copy button takes them all.
- Negative numbers and decimals are refused with a message.
Put it into practice
Prime Number Checker
Check whether a number is prime, see its prime factors and all its divisors, find the next and previous prime, and list every prime up to…
Runs in your browserGCD and LCM Calculator
Find the greatest common divisor and least common multiple of two or more whole numbers, with prime factorisations and the Euclidean algo…
Runs in your browserFraction Calculator
Add, subtract, multiply or divide two fractions with exact integer arithmetic: simplified results, mixed-number form and decimal value.
Runs in your browserScientific Calculator
Work out expressions with trigonometry, logarithms, powers, roots, factorials and percentages, with degree and radian modes, a live previ…
Runs in your browserHow this guide is maintained
This page is reviewed when the related tools change. It describes what the published tools actually do: the tools run in your browser tab, so your files stay on your device. If you find something inaccurate, email [email protected] and it will be corrected.
Other guides
- How to merge PDFs without uploading them6 min · 17 November 2026
- OCR a scanned PDF: accuracy, limits and privacy7 min · 17 November 2026
- Compress a PDF without destroying readability6 min · 17 November 2026