一道Pascal问题,求程序!求用函数解!题目在下面.如果一个自然数是素数,且它的数字位置经过对换后仍为素数,则称为绝对素数,例如13.试求出所有二位绝对素数.
网友回答
var i:longint;
function sushu(s:longint):boolean;
var i:longint;
beginsushu:=true;
for i:=2 to s div 2 do
if s mod i=0 then
sushu:=false;
end;beginfor i:=10 to 99 do
if sushu(i)and sushu(i mod 10 * 10+i div 10) then
write(i,' ');
end.