function IsPrime(Self: integer): boolean; extensionmethod;
// является ли число простым ?
begin
if Self < 4 then Result := True
else
var found := (Self mod 2 = 0);
var p := 3;
while (not found) and (sqr(p) <= Self) do
found := (Self mod p = 0);
p += 2
end;
Result := not found
end
var (m, n) := ReadInteger2('Введите m и n:');
Range(m, n).Where(t -> not t.IsPrime).Println
end.
function IsPrime(Self: integer): boolean; extensionmethod;
// является ли число простым ?
begin
if Self < 4 then Result := True
else
begin
var found := (Self mod 2 = 0);
var p := 3;
while (not found) and (sqr(p) <= Self) do
begin
found := (Self mod p = 0);
p += 2
end;
Result := not found
end
end;
begin
var (m, n) := ReadInteger2('Введите m и n:');
Range(m, n).Where(t -> not t.IsPrime).Println
end.