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

8 lines
156 B
ObjectPascal
Raw Permalink Normal View History

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