How To Check If A Number Is Prime Or Not?

If the number is less than 2, it is not prime.

If the number is 2, it is prime.

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

Check whether the number is divisible by any integer from 3 up to the square root of the number.

If it is divisible by any of those integers, it is not prime.

If it is not divisible by any of those integers, it is prime.

Suggested for You

Trending Today