Concept Flow - Check if Number is Prime
Start with number n
Check if n <= 1?
Yes→Not Prime
No
Set divisor = 2
Is divisor * divisor <= n?
No→Prime
Yes
Check if n % divisor == 0?
Yes→Not Prime
No
Increment divisor by 1
↩Back to divisor * divisor <= n check
Start by checking if the number is less than or equal to 1 (not prime). Then test divisors from 2 up to the square root of the number. If any divisor divides the number evenly, it is not prime; otherwise, it is prime.
