Prime Number Checker
Check whether a number of up to 100 digits is prime, find its prime factors, its divisors and the primes on either side of it.
Answer
- Previous prime
- 2,147,483,629
- Next prime
- 2,147,483,659
- Number of divisors
- 2
- Sum of divisors
- 2,147,483,648
- Perfect, abundant or deficient
- deficient
- Checked by the Miller–Rabin test with the first 13 primes as bases, which is a proof for every number below 3.3 × 10^24.
Number
How is this calculated?
Miller–Rabin: write n − 1 = 2^s × d; n passes for base a if a^d ≡ 1 or a^(2^r × d) ≡ −1 (mod n) for some r < s · Factors: trial division, then Pollard’s rho · Divisors of p₁^k₁ × p₂^k₂ … : (k₁ + 1)(k₂ + 1)…Runs in your browser — nothing you enter leaves this device.
About this tool
What it does
Type a whole number and this tool says whether it is prime. If it is not, it splits the number into its prime factors, such as 360 = 2³ × 3² × 5. It also gives the previous and next primes, how many divisors the number has and what they add up to, whether the number is perfect, and — when there are not too many — every divisor. It works for numbers of up to 100 digits.
How to use it
- Type the number. Commas and spaces are ignored, so 1,00,003 and 100 003 both work.
- Read the verdict at the top. For a number that is not prime, its prime factorisation appears under it.
- See the primes just below and above it, and the number of divisors and their sum.
- For numbers with up to 120 divisors, every divisor is listed in order.
Limits and your data
- Below 3,317,044,064,679,887,385,961,981 (about 3.3 × 10^24) the answer is a proof: the Miller–Rabin test with the first thirteen primes as bases has no exceptions in that range (Sorenson and Webster, 2015).
- Above that, the test is run with twenty bases. No composite number is known to pass, but it is not a proof, so the answer says "almost certainly".
- Factorising is hard: a number made of two large primes, each 15 digits or more, may not split in the few seconds allowed. The page then says which part it could not split, rather than guessing.
- Primes are whole numbers above 1. 0, 1 and negative numbers are neither prime nor composite.
- Everything is worked out on your device. Large numbers are factorised in a separate background thread of this page so it stays responsive; nothing is sent anywhere or saved.
Questions
What is a prime number?
A whole number above 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13 and so on. 2 is the only even prime. Every whole number above 1 is either prime or a product of primes, in exactly one way.
Why is 1 not a prime?
If 1 were prime, numbers would have many prime factorisations (6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3…), and the rule that each number factorises in exactly one way would fail. So 1 is set apart as neither prime nor composite.
How can it check a 100-digit number so quickly?
It does not try every divisor. The Miller–Rabin test uses a property every prime has — a fact about powers, from Fermat’s little theorem — and checks it for a few bases. A composite number almost always fails at the first base, and for numbers in the proven range, passing all thirteen bases guarantees the number is prime.
Is 2,147,483,647 prime?
Yes. It is 2³¹ − 1, a Mersenne prime found by Euler in 1772, and the largest value a signed 32-bit integer can hold, which is why programmers meet it.
What is a perfect number?
One whose divisors other than itself add up to it: 6 = 1 + 2 + 3, and 28 = 1 + 2 + 4 + 7 + 14. If they add up to more it is abundant (12), and if less, deficient (every prime).