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 number is less than or equal to 1 (not prime). Then test divisors from 2 up to sqrt(n). If any divides n exactly, number is not prime; otherwise, it is prime.
