Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- a:array of boolean;
- i,j,n,m:longint;
- Begin
- read(n,m);
- SetLength(a,m+1);
- for i:=2 to m do
- a[i]:=true;
- for i:=2 to trunc(sqrt(m)) do
- if a[i] then
- begin
- j:=sqr(i);
- while (j<=m) do
- begin
- a[j]:=false;
- inc(j,i);
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment