How it is calculated
- The calculator tries to divide the number by 2, then by odd numbers 3, 5, 7, … up to its square root
- If none divides it evenly, the number is prime
- The first divisor found is the smallest factor, and it gives the factor pair
- The previous and next primes are found by testing the numbers around it the same way
To break a number into prime factors, use the prime factorization calculator. For common factors, use the GCF calculator.
Worked example
- 97: no number from 2 to 9 divides it, so it is prime. The previous prime is 89 and the next is 101.
- 91: it is divisible by 7, since 7 × 13 = 91, so it is composite.
Why your number may differ
The calculator accepts whole numbers up to one trillion. For much larger numbers, special methods are needed, which are beyond this page.