function IsPrime(n: integer): boolean;
begin
if n < 4 then Result := True
else
var found := (n mod 2 = 0);
var p := 3;
while (not found) and (sqr(p) <= n) do
found := (n mod p = 0);
p += 2
end;
Result := not found
end
function IsPalindrom(n: integer): boolean;
Result := True;
if n > 10 then
var (n1, i) := (n, -1);
var a := new integer[9];
while n1 > 0 do
i += 1;
a[i] := n1 mod 10;
n1 := n1 div 10
for var j := 0 to i div 2 do
if a[j] <> a[i - j] then
Result := False;
break
var (i, k) := (3, 1);
repeat
if IsPrime(i) and IsPalindrom(i) then k += 1;
i += 2
until k >= 101;
(i - 2).Println
end.
function IsPrime(n: integer): boolean;
begin
if n < 4 then Result := True
else
begin
var found := (n mod 2 = 0);
var p := 3;
while (not found) and (sqr(p) <= n) do
begin
found := (n mod p = 0);
p += 2
end;
Result := not found
end
end;
function IsPalindrom(n: integer): boolean;
begin
Result := True;
if n > 10 then
begin
var (n1, i) := (n, -1);
var a := new integer[9];
while n1 > 0 do
begin
i += 1;
a[i] := n1 mod 10;
n1 := n1 div 10
end;
for var j := 0 to i div 2 do
begin
if a[j] <> a[i - j] then
begin
Result := False;
break
end
end
end
end;
begin
var (i, k) := (3, 1);
repeat
if IsPrime(i) and IsPalindrom(i) then k += 1;
i += 2
until k >= 101;
(i - 2).Println
end.
Результат: 94349