## Checking For Prime

prime numbers are surprisingly easy to check for. to check if a number is prime, we divide it by it’s factors. 1 is not prime

1 2 3 4 5 6 |
def is_prime(num): if num > 1: for i in range(2, num): if num%i == 0: return False return True |

we take all numbers from 2 to the num and we start dividing by 2, 3, 4, 5, … but really we need only to go to half the… Continue Reading Checking For Prime