Q:

A prime number checker that fails

It seems like a normal code and works well, but for whatever reasons when I try entering this number = 18765411123451, computer seems to freeze, any clue?
num = 18765411123451

if num > 1:
  for i in range(2,num):
    if num % i == 0:
      print(num,"is not a prime number")
      print("Because", i,"x",num//i, "=" ,num)
      break
  else:
    print(num,"is a prime number")
else:
  print(num,"is not a prime number")

I've tried many other numbers and the code works as it should except that number. What happened here? 

A:

it freezes because your number just too high.
The reason is for i in range(2,num): with num = 18765411123451 with is 100 trillion...
Plus the fact that python 2 will try to allocate that memory just to create the list to iterate on it (in that case use xrange)
Good news: you don't have to check until the number itself, just check until square root (included):
for i in range(2,int(num**0.5)+1):

that's more reasonable (less that 5 million iterations) and will provide the same result.
Past the square root of a number, if you haven't found divisors, you won't find any afterwards (if q is a divisor of num, then p*q == num so either p or q has to be lower or equal than square root of num

