Prime factors in python
问题 I am looking for prime factors of 2500 with the code below, but my code only prints 2 currently and I am unsure why this is the case. no = 2500 count = 0 # Finding factors of 2500 for i in range(1,no): if no%i == 0: # Now that the factors have been found, the prime factors will be determined for x in range(1,no): if i%x==0: count = count + 1 """Checking to see if the factor of 2500, itself only has two factor implying it is prime""" if count == 2: print i Thanks 回答1: using sieve of