def pandigital_products(): lListG = [] for i in range(2, 1000): lStrI = str(i) if not is_digits_unique_19(lStrI): continue lFrom = 10 ** (4 - len(lStrI)) lTo = 9999 // i + 1 # print('i: ' + str(i) + ' from: ' + str(lFrom) + ' to: ' + str(lTo)) for j in range(lFrom, lTo): lStrJ = lStrI + str(j) if not is_digits_unique_19(lStrJ): continue k = i * j lStrJ += str(k) if not is_digits_unique_19(lStrJ): continue if not k in lListG: # print(str(i) + ' x ' + str(j) + ' = ' + str(k)) lListG.append(k) lSum = 0 for i in lListG: lSum += i return lSum
def pandigital_multiples(): lMax = 0 for i in range(2, 99999): lStr = str(i) for j in range(2, 7): lStr += str(i * j) if len(lStr) > 9: break if len(lStr) == 9: if is_digits_unique_19(lStr): lInt = int(lStr) # print('p Int: ' + str(lInt)) if lInt > lMax: # print('new Max: ' + str(lInt) + ' Base: ' + str(i)) lMax = lInt return lMax