def eul32(): """"Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.""" products = set() for product in range(1000, 10000): if len(set(eul.get_digits(product))) == len(str(product)): for i in eul.get_proper_divisors(product): j = int(product / i) test = ''.join([str(i), str(j), str(i*j)]) if len(test) == 9 and eul.pandigital(test): products.add(i*j) return sum(products)
def eul41(): """What is the largest n-digit pandigital prime that exists?""" for p in range(7654321, 1, -2): if eul.pandigital(p, 7) and eul.prime(p): return p