Here I meet a problem to check the factors of a prime number
# using python2.7.10
from math import sqrt
def isprime(x):
if x == 1:
return False
k = int(sqrt(x))
for j in range(2,k+1):
if x%j == 0:
return False
return True
num = input("please input a number:")
for i in range(2, num):
if i!= num and num % i == 0:
print i,
If I input a number 45, it prints out 3,5,9,15. However, 3 is a factor of 9 and 15, 5 is a factor of 15. I hope the results are 3, 5. How can I change my code in order to achieve my goal?