Is It Prime? Prime Number Checker

Check whether a whole number is prime, and see why: which primes were tested up to its square root, or which one divides it.

Prime factorization

360 = 2³ × 3² × 5

360 = 2³ × 3² × 5.

Show me how

All steps as text

    Tip: press ← and → to move between steps, or click any step.

    How to check if a number is prime

    1. Work out the square root of the number. You only need to test primes up to it: if a number had a factor bigger than its square root, the matching factor would be smaller.
    2. Use quick rules first: even numbers (except 2) aren’t prime, nor are numbers whose digits add up to a multiple of 3 (except 3), nor numbers ending in 0 or 5 (except 5).
    3. Divide by each prime up to the square root. If none goes in exactly, the number is prime.

    For 91: √91 ≈ 9.5, so test 2, 3, 5 and 7. 91 ÷ 7 = 13, so 91 = 7 × 13 is not prime.

    Questions

    What are the prime numbers up to 50?

    2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 and 47.

    Why is 2 the only even prime?

    Every other even number is divisible by 2, so it has a factor besides 1 and itself.

    Are there infinitely many primes?

    Yes. Euclid proved it over 2,000 years ago: multiply any list of primes together and add 1, and the result has a prime factor that isn’t in the list.