var i,j,k,m: integer; s: string; begin k:=0; for i:=1 to 1000000 do begin s:=IntToStr(i); m:=0; for j:=1 to (length(s) div 2) do if s[j]<>s[length(s)-j+1] then m:=1; if m=0 then begin inc(k); continue; end; m:=pos('0',s); if m>0 then begin inc(k); continue; end; m:=1; for j:=2 to round(sqrt(i)) do if i mod j = 0 then begin m:=0; break; end; if m=1 then inc(k); end; k:=1000000-k; writeln('осталось чисел: ',k); end.
var i,j,k,m: integer; s: string; begin k:=0; for i:=1 to 1000000 do begin s:=IntToStr(i); m:=0; for j:=1 to (length(s) div 2) do if s[j]<>s[length(s)-j+1] then m:=1; if m=0 then begin inc(k); continue; end; m:=pos('0',s); if m>0 then begin inc(k); continue; end; m:=1; for j:=2 to round(sqrt(i)) do if i mod j = 0 then begin m:=0; break; end; if m=1 then inc(k); end; k:=1000000-k; writeln('осталось чисел: ',k); end.
#include <iostream>
int main()
{
int a;
unsigned int i = 0;
std::cin >> a;
while (a != i)
{
++i;
}
std::cout << i;
return 0;
}