Var i,j,m,k : integer; begin k:=0; for i:=5523 to 6572 do begin m:=0; for j:=2 to trunc(sqrt(i)) do if i mod j = 0 then m:=m+1; if m=0 then if ((i div 1000)+(i div 100 mod 10)+(i div 10 mod 10)+(i mod 10)) mod 2 = 0 then k:=k+1; end; writeln('k=',k); end.
begin
k:=0;
for i:=5523 to 6572 do
begin
m:=0;
for j:=2 to trunc(sqrt(i)) do
if i mod j = 0 then m:=m+1;
if m=0 then
if ((i div 1000)+(i div 100 mod 10)+(i div 10 mod 10)+(i mod 10)) mod 2 = 0 then k:=k+1;
end;
writeln('k=',k);
end.
Результат:
k=58