from math import *
sum=0
def check(x,m1,m2):
f=[]
a=str(x)
b=str(m1)
c=str(m2)
for i in range(len(a)):
if a[i]=='0':
return False
if a[i] in f:
return False
f.append(a[i])
for i in range(len(b)):
if b[i]=='0':
return False
if b[i] in f:
return False
f.append(b[i])
for i in range(len(c)):
if c[i]=='0':
return False
if c[i] in f:
return False
f.append(c[i])
if len(f)!=9:
return False
return True
l=[]
for i in range(1,10000):
x=i
for j in range(1,int(sqrt(x)+1)):
if(x%j==0):
m1=j
m2=x//j
if check(x,m1,m2)==True:
if x not in l:
sum+=x
l.append(x)
print(x,' ',m1,' ',m2)
print(sum)
sum=0
def check(x,m1,m2):
f=[]
a=str(x)
b=str(m1)
c=str(m2)
for i in range(len(a)):
if a[i]=='0':
return False
if a[i] in f:
return False
f.append(a[i])
for i in range(len(b)):
if b[i]=='0':
return False
if b[i] in f:
return False
f.append(b[i])
for i in range(len(c)):
if c[i]=='0':
return False
if c[i] in f:
return False
f.append(c[i])
if len(f)!=9:
return False
return True
l=[]
for i in range(1,10000):
x=i
for j in range(1,int(sqrt(x)+1)):
if(x%j==0):
m1=j
m2=x//j
if check(x,m1,m2)==True:
if x not in l:
sum+=x
l.append(x)
print(x,' ',m1,' ',m2)
print(sum)