М | Тема переносится в Задачи |
uses crt;
var k, delitelj, i : Integer;
Find : boolean;
begin
readln (k);
while find = False do
begin
delitelj:=0;
inc (k);
for i:=1 to K do if (k mod i = 0) then inc (delitelj);
If delitelj = 2 then
begin
find:= True;
writeln (K);
end;
end;
readkey;
end.
var
k,b,m:longint;
bl:boolean;
begin
readln(m);
if (m=2) then writeln('3')
else
if (m=3) then writeln('5')
else
repeat
inc(m); b:=2; k:=m div 2;
while (m mod b<>0)and(b<k) do
begin
inc(b);
if b=k then
begin
writeln(m);
bl:=true;
halt;
end;
end;
until bl=true;
end.