Check whether a whole number up to 10^15 is prime, see its factors, and find the previous and next prime.
Type a whole number from 0 to 10^15 (1,000,000,000,000,000). Spaces, commas and underscores are ignored, so 1,000,000,007 works; letters, decimals and negative signs show a message. The answer is given in words: Yes, 97 is prime; No, 91 is not prime (composite); or, for 0 and 1, neither prime nor composite, since a prime needs exactly two divisors. A composite number also shows its smallest factor (91 = 7 × 13) and, up to 10^12, its full prime factorisation written like 2^12 × 5^12. Above 10^12 only the smallest factor is shown.
Numbers below 1,000,000,000 are checked by trial division: the number is divided by 2, 3, 5, 7, 11, 13 and so on up to its square root. Larger numbers use the Miller-Rabin test with the 13 witnesses 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 and 41. That set is proven to give the correct answer for every number below 3.317 × 10^24, far above the 10^15 limit, so the result is a certainty, not a probability. It uses BigInt for the modular arithmetic. In a browser without BigInt the page uses trial division for everything, which is still correct but much slower for the largest numbers.
The page walks down and up from your number, testing each candidate, and shows the nearest prime on each side: for 91 these are 89 and 97. For 2 the previous prime is None, since no prime is smaller. The next prime can be above 10^15 (the next prime after 10^15 is 1,000,000,000,000,037). Near 10^15 the gap between primes is typically a few dozen numbers.
The limit of 10^15 keeps every number exactly representable in the browser. A prime is confirmed in a blink; a composite number near the limit can take a moment longer, because its smallest factor is found by trial division, up to about 10 million steps. Numbers beyond the limit show a message. Everything runs in this tab, and nothing you type is stored or sent anywhere.
No. A prime has exactly two divisors, 1 and itself, and 1 has only one. The page calls 1 neither prime nor composite, and says the same of 0.
It runs the Miller-Rabin test with 13 fixed witnesses. For numbers below 3.317 × 10^24 this set is proven to be right every time, so 999,999,999,999,989, the largest prime below 10^15, is confirmed exactly rather than guessed.
10^15, which is 1,000,000,000,000,000. The full prime factorisation of a composite number is shown up to 10^12; above that you still get the verdict, the smallest factor, and the previous and next prime.
The smallest prime factor is the quickest proof that a number is not prime: 91 = 7 × 13. The complete list of prime factors (2^3 × 3^2 × 5 for 360) is shown for numbers up to 10^12.
Yes. The next prime after 10^15 is 1,000,000,000,000,037, and the page shows it, because the test is exact far beyond the input limit.
Yes. 2 is the only even prime. Its previous prime is shown as None and its next prime is 3.