def is_terminating(n): if n==2 or n==5: return True if n%2==1 and n%5==1: return False prime_factors = mwmath.find_prime_factors(n) if (prime_factors[0] == [2]) or (prime_factors[0] == [5]) or (prime_factors[0] == [2,5]): return True else: return False
def is_terminating(n): if n == 2 or n == 5: return True if n % 2 == 1 and n % 5 == 1: return False prime_factors = mwmath.find_prime_factors(n) if (prime_factors[0] == [2]) or (prime_factors[0] == [5]) or (prime_factors[0] == [2, 5]): return True else: return False
import math import mwmath import time s = time.time() N_factors = 3 ii = 1 consecutive_N = 0 while consecutive_N<N_factors: factor_list = mwmath.find_prime_factors(ii) cur_factors = len(factor_list[0]) if cur_factors==N_factors: consecutive_N+=1 else: consecutive_N = 0 ii+=1 print ii-N_factors print time.time()-s