def answer(n): for start in count(): for offset in range(n): if len(set(factors(start+offset))) != n: break else: return start
#!/usr/bin/python import prime num, count, answer = 644, 0, 0 while True: if len(set(list(prime.factors(num)))) == 4: if count == 0: answer = num count += 1 if count == 4: print "Answer: %s" % answer break else: answer, count = 0, 0 num += 1
def distinct_factors(n): return len(dict.fromkeys(prime.factors(n)).keys()) factors = [0, 1, distinct_factors(2), distinct_factors(3)]