Prime Number Tester & Explorer

Test if any number is prime, inspect nearest prime neighbors, prime gaps, and special prime types.

Understanding Prime Numbers & Primality Tests

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Numbers greater than 1 with more than two factors are composite.

6k ± 1 Primality Rule

All prime numbers p > 3 can be written in the form 6k + 1 or 6k − 1

Trial division only needs to test prime divisors up to √n. If no prime factor ≤ √n divides n, then n is guaranteed to be prime.

Step-by-Step Worked Examples

Testing 97

√97 ≈ 9.84. We only need to check primes 2, 3, 5, 7. None of these divide 97, so 97 is prime! Its nearest primes are 89 and 101.

Frequently Asked Questions

Why is 2 the only even prime number?

Any even number greater than 2 is divisible by 2, which gives it at least three factors (1, 2, and itself), making it composite.

What is a Sophie Germain prime?

A prime number p is a Sophie Germain prime if 2p + 1 is also a prime number (e.g., 23 is prime, and 2 × 23 + 1 = 47 is also prime).