How To Check Prime Number?

A prime number is a whole number greater than 1 with exactly two factors: 1 and itself

Check whether the number is greater than 1

Check divisibility by 2

If the number is 2, it is prime

If the number is even and greater than 2, it is not prime

Test divisibility by odd numbers starting from 3

Stop testing at the square root of the number

If any tested number divides it evenly, it is not prime

If no tested number divides it evenly, it is prime

Suggested for You

Trending Today