Prime Number and Prime Factorization Calculator
Is the number prime, its prime factors, its divisors, the previous and next prime. All primes in a range with the sieve of Eratosthenes. Exact up to 2⁶⁴, with steps.
What is a prime number and what does this tool do?
A prime number is a whole number greater than 1 that is divisible only by 1 and by itself: 2, 3, 5, 7, 11, 13 and so on. This tool tells you whether the number you type is prime. If it is not, it splits the number into prime factors, lists every positive divisor, gives the number and sum of the divisors and finds the nearest prime below and above. The second tab lists all primes between two bounds.
How do you check that a number is prime?
Divide n by each prime that does not exceed its square root. If none of them divides evenly, n is prime. Stopping at the square root is enough, because if n = a · b then one of the two factors is at most the square root. The tool shows these divisions with their remainders step by step.
Example
For 97 the square root is about 9.8, so the primes to try are 2, 3, 5 and 7. The remainders are 1, 1, 2 and 6. None is zero, so 97 is prime. 360 is not prime: it factors as 2³ · 3² · 5. Add one to each exponent and multiply to count the divisors: (3 + 1) · (2 + 1) · (1 + 1) = 24.
Primes in a range
The sieve of Eratosthenes starts at 2 and crosses out the multiples of each prime. Whatever is left is prime. There are 25 primes from 1 to 100 and 168 from 1 to 1000.
Limits
The single number check works up to 2⁶⁴ − 1 and the answer is exact up to that limit. The range scan goes up to 1 000 000. Type numbers with digits only. Spaces between digit groups are fine. Primality is not defined for decimals or negative numbers.
Related calculators
-
Mathematics
GCD and LCM Calculator
GCD and LCM of two to six numbers. Euclidean algorithm steps, the prime factor method, the division ladder and the check GCD · LCM = a · b. -
Mathematics
Combination, Permutation and Factorial Calculator
n!, P(n, r), C(n, r), permutations of repeated items, combinations with repetition and circular permutations. Exact to the last digit, with the expansion shown. -
Mathematics
Number Base Converter (Binary, Octal, Hex)
Convert between bases 2 to 36: binary, octal, decimal, hexadecimal. Fractional numbers, repeating expansions, division and multiplication steps, two's complement. -
Mathematics
Scientific Calculator
Type an expression and see the result at once: trigonometry, logarithms, powers, roots, factorials. Degree and radian modes, memory and history, all in your browser.
Found a mistake or something missing?
If a value looks wrong, a size is missing or you need a feature, write to us and we will fix it.