[codep ]var i,m,n:longint;
function pd(x:longint):boolean;
var bo:boolean;
i:longint;
begin
bo:=true;
i:=2;
while (bo=true) and (i<=sqrt(x)) do
if x mod i=0 then bo:=false
else inc(i);
exit(bo);
end;
function hw(x:longint):boolean;
var i,j,m,n:longint;
s:string;
begin
s:='';
str(x,s);
m:=length(s);
if(m=4)and(m=6) then exit(false);
if(m<>1) and ((s[1]='2')or(s[1]='4')or(s[1]='5')or(s[1]='6')or(s[1]='8')or(s[1]='0')) then exit(false);
i:=m;
j:=1;
while (j<i) and (s[j]=s[i]) do
begin
dec(i);
inc(j);
end;
if j>=i then exit(true)
else exit(false);
end;
begin
read(m,n);
for i:=m to n do
if hw(i) then begin
if pd(i) then writeln(i);
end;
end.[/codep ]
请大神修改,帮忙优化