[Solved] Why does prime number checker say 9 is a prime number?
To check if number is prime you have to validate is it devisible by any number in range [2, sqrt(n)]. Following code does exactly the same: import math def is_prime(n): for i in range(2, int(math.sqrt(n))+1): if n % i == 0: return False return True This method is good for small number, but if n … Read more