pascalabcnet/_Presentations/2015 New Features/Programs/12_Range - 1.pas

8 lines
156 B
ObjectPascal
Raw Permalink Normal View History

2015-05-14 22:35:07 +03:00
function IsPrime(x: integer): boolean;
begin
Result := Range(2,Round(sqrt(x))).All(i->x mod i <> 0)
end;
begin
Range(2,1000).Where(IsPrime).Print;
end.