Prime number checker
Math & numbersIs your number a prime number?
Test any whole number up to 100 digits for primality, with its prime factors and the next and previous prime.
What you enter stays on your device while you use this tool. Opening a shared link sends the settings in its address to HowToolbox to prepare the page.
A whole number of up to 100 digits
Is it prime?
Not prime
24 is a composite number: it has divisors other than 1 and itself.
About this number
- Certainty
- Proven
- Next prime
- 101
- Previous prime
- 89
Sponsored Links
Test any whole number up to 100 digits for primality, with its prime factors and the next and previous prime.
How to use
- Type a whole number. Spaces or commas between groups of digits are fine.
- Read whether it is prime, how sure the answer is, and its prime factors, next prime and previous prime.
- Copy any value, or copy the link to share the same number.
Prime factors of common numbers
How it works
A prime number is a whole number above 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11 and so on. Every other number above 1 is composite and is a product of primes in exactly one way, apart from the order: 1200 = 2⁴ × 3 × 5². The numbers 0 and 1 are neither prime nor composite.
Dividing by every possible factor is far too slow for big numbers, so the check uses the Miller–Rabin test. It takes a base a and looks for a pattern in the powers of a that every prime must follow; a composite number usually breaks the pattern, and the base that breaks it is a witness. Below about 3.3 × 10²⁴ a fixed set of the first 13 primes as bases is known to catch every composite, so “prime” there is a proof. Above that, no fixed set is proven, so a number that passes 20 bases is shown as “probably prime”: certain enough for practice, but not a proof. “Not prime” is always a proof.
Prime factors are found by trial division, which is instant up to 10¹⁵ (a thousand trillion). Above that a composite number is recognised as composite but not factored here. That gap is no accident: testing whether a number is prime is much easier than finding its factors, and much of modern encryption relies on it.
Sponsored Links
Frequently asked questions
Is 1 a prime number?
No. A prime has exactly two divisors, and 1 has only one. Treating 1 as prime would also break the rule that every number has a single prime factorisation.
Is 2 the only even prime?
Yes. Every other even number is divisible by 2, so it has a divisor besides 1 and itself.
What does “probably prime” mean?
The number passed 20 Miller–Rabin tests with different bases. No composite number is known that fools them all, but for numbers this large it has not been proven, so the page does not call it proven.
How many primes are there?
Infinitely many, as Euclid showed over two thousand years ago. They thin out as numbers grow, but there is always a next one.
Why are no prime factors shown for a large composite number?
This tool factors numbers only up to 10¹⁵. Above that limit it can still identify a composite number without finding its factors.
Next you might need
- Average calculatorMean, median, mode and range of a list of numbers, with the count, sum, smallest and largest., private, runs on your deviceMath & numbersCalculatorStatistics
- Combinations and permutations calculatorExact counts of combinations and permutations, with or without repetition, and the chance of one particular pick., private, runs on your deviceMath & numbersCalculatorStatistics
- Confidence interval calculatorThe confidence interval for a mean or a proportion from a sample, with the margin of error and the method used., private, runs on your deviceMath & numbersCalculatorStatistics
- Fraction calculatorAdd, subtract, multiply and divide fractions and mixed numbers, or turn a decimal into a fraction, with the answer in lowest terms., private, runs on your deviceMath & numbersCalculator
- Number base converterConvert whole numbers between binary, octal, decimal, hexadecimal and any base up to 36., private, runs on your deviceMath & numbersConverterCalculator
- Percentage calculatorPercent of a number, what percent one number is of another, percentage change and difference, and the number before a discount., private, runs on your deviceMath & numbersCalculatorCostsStatistics
More in Math & numbers
All 24 utilities in Math & numbers- Area of shapesArea and perimeter of rectangles, circles, triangles and eight more shapes, drawn to scale., private, runs on your device
- Ratio calculatorSimplify a ratio to its lowest terms, or find the missing number in an equal ratio, the rule of three., private, runs on your device
- Sample size calculatorThe number of survey responses you need for a margin of error and confidence level, for any population size., private, runs on your device
- Scientific calculatorType a calculation or use the keys., private, runs on your device
- Scientific notation converterWrite a number in scientific and engineering notation with the significant figures you choose, or turn 6.022e23 back into digits., private, runs on your device
- Standard deviation calculatorSample or population standard deviation and variance of a list of numbers, with the mean and the standard error., private, runs on your device
Popular now
Sponsored Links
Sponsored Links
Sponsored Links