def main(): n = 1489 while True: b, c = n + 3330, n + 3330 * 2 if isprime(n) and isprime(b) and isprime(c) \ and is_perm(n, b) and is_perm(b, c): break n += 2 print str(n) + str(b) + str(c)
def main1(): """This aproach is very slow.""" end = 10 ** 7 lowerbound = 2000 upperbound = 5000 numbers = list() # totient(n) is a permutation of n for i in xrange(2, end): if is_perm(i, totient(i)): numbers.append(i) print len(numbers)
def main2(): semiprimes = create_semiprimes() numbers = set() # totient(n) is a permutation of n min_value = 100 min_n = 0 for semiprime in semiprimes: if is_perm(semiprime, totient(semiprime)): numbers.add(semiprime) for num in numbers: tmp = num / float(totient(num)) if tmp < min_value: min_value = tmp min_n = num print min_n