Check if a number is prime by testing divisibility up to √N!
A prime number is only divisible by 1 and itself. To check if N is prime:
Why √N? If N = a × b and a ≤ √N, then b ≥ √N. So we
only need to check up to √N!
This makes the algorithm O(√N) instead of O(N).