Prime Number Checker
How This Converter Works
Checks whether the entered decimal integer is prime. Surrounding whitespace is trimmed, and any input containing characters other than decimal digits is reported as not prime. Values below 2 are not prime.
Formula or rule
For n <= 2^53 - 1, test 2, 3, then divisors 6k - 1 and 6k + 1 through floor(sqrt(n)); for larger inputs, use BigInt divisibility checks and Miller-Rabin with the first 12 prime bases.
Example
- Input
- 29
- Calculation
- 29 is greater than 1; neither 2 nor 3 divides it, and no 6k +/- 1 divisor through floor(sqrt(29)) = 5 divides it.
- Result
- 29 - Prime Number
Notes
The input field accepts up to 20 characters. BigInt avoids precision loss above JavaScript’s safe-integer limit, and the selected Miller-Rabin bases give exact results throughout this 20-digit input range.