18 lines
355 B
Python
18 lines
355 B
Python
import itertools
|
|
from pprint import pprint
|
|
|
|
MAX_NUM = int(999999999**0.5) + 1
|
|
|
|
results = []
|
|
|
|
for i in range(MAX_NUM):
|
|
for j in range(MAX_NUM):
|
|
num = i * j
|
|
if ''.join(sorted(str(i) + str(j) + str(num))) == '123456789':
|
|
results.append((i, j, num))
|
|
|
|
pprint(results)
|
|
print(len(results))
|
|
print(sum(set(x[2] for x in results)))
|
|
|