def solve(): n = 428571 d = 0 while True: if (7*n+1) % 3 == 0: d = (7*n+1) / 3 print '(n,d) = (%s,%s)' % (n, d) break n = n - 1 l1 = mtools.prime_factors(n) l2 = mtools.prime_factors(d) print l1,l2 return 'n in hcf(n,d)'
def min_product_sum_with_start(k, start): #print 'min_product_sum_with_start(%d,%d) = ' % (k, start), i = start while True: if not mtools.is_prime(i): p, c = mtools.prime_factors(i) #i-k + len(factors) == sum(factors) if search_match(i, p, c, k): #print i return i i = i + 1
def prime_prod(n): p,c = mtools.prime_factors(n) if len(p) == 1 and c[0] > 1: return (p[0], c[0]) return None
def phi(n): p, c = mtools.prime_factors(n) s = n for x in p: s = s - s/x return s
def primes_n(s, n): for i in range(s, s+n): p, num = mtools.prime_factors(i) if len(p) != n: return False return True