Decide whether 17 is prime by testing prime divisors up to the square
root of 17. If none divide 17 evenly, the number is prime.
Example
Test whether 17 has any prime factor up to its square root.
highlighted = computed this step
Step 1 — Set up
Set up the numbers to test.
primecheck:17
Step 2 — Test 2
Test divisibility: 17 ÷ 2 = 8 remainder 1.
17÷2=8r1
Step 3 — Test 3
Test divisibility: 17 ÷ 3 = 5 remainder 2.
17÷3=5r2
Step 4 — Verdict
17 is prime because no prime up to sqrt(17) divides it.
17 is prime because no prime up to sqrt(17) divides it
primality-testA prime number has exactly two factors: 1 and itself. To check, try dividing by each prime up to the square root. For 17, test 2 and 3. If any trial succeeds (remainder 0), the number is composite. Stop as soon as one works.