why are we running the loop till N-1?
can’t we just run it till the square root of the number?
because anyways after the square root all the factors will start repeating.
Loop stopping condition
Yes you are right. This was the naive approach. In the further videos, you will be taught more optimized ways to check prime. Then this will be considered.