procedure TForm1.Button1Click(Sender: TObject);
type
TmyArray = Array[0..7] Of Integer;
var i,j,m,k,t:integer;
s:string;
a1,a2,a3,a4,a5,a6,a7,a8:integer;
myarray : TmyArray;
bm:boolean;
begin
for j:=2 to 8 do
begin
for i:=123 to 987 do
begin
m:=i*j;
s:=''+IntToStr(i)+'*'+IntToStr(j)+'='+IntToStr(m)+'';
if m>1000 then
begin
a1:=StrToInt(copy(IntToStr(i),1,1));
a2:=StrToInt(copy(IntToStr(i),2,1));
a3:=StrToInt(copy(IntToStr(i),3,1));
a4:=StrToInt(copy(IntToStr(m),1,1));
a5:=StrToInt(copy(IntToStr(m),2,1));
a6:=StrToInt(copy(IntToStr(m),3,1));
a7:=StrToInt(copy(IntToStr(m),4,1));
a8:=j;
if (a1+a2+a3+a4+a5+a6+a7+a8=36) then
begin
if (a1>0) and (a1<9) and (a2>0) and (a2<9) and (a3>0) and (a3<9) and
(a4>0) and (a4<9) and (a5>0) and (a5<9) and (a6>0) and (a6<9) and (a7>0) and (a7<9) then
begin
myarray[0]:=a1;
myarray[1]:=a2;
myarray[2]:=a3;
myarray[3]:=a4;
myarray[4]:=a5;
myarray[5]:=a6;
myarray[6]:=a7;
myarray[7]:=a8;
bm:=false;
for k:=0 to 7 do
begin
for t:=0 to 7 do
begin
if (k<>t) and (myarray[k]=myarray[t]) then
begin
bm:=True;
end;
end;
end;
if bm=false then Memo1.Lines.Add(s);
end;
end;
end;
end;
end;
end;