主题:急!用筛法求素数!
有一个筛法求素数的程序,总运行不了?
program nbu786(input,output);
const x=100;
var
s: set of 1.. x;
n,m:integer;
begin
s:=[2..n];
n:=2;
repeat
while not (n in s) do
n:=n+1;
writeln(n);
m:=n;
while m<=n do
begin
s:=s-[m];
m:=m+n;
end;
until s=[ ]; write(n,m);
end.
program nbu786(input,output);
const x=100;
var
s: set of 1.. x;
n,m:integer;
begin
s:=[2..n];
n:=2;
repeat
while not (n in s) do
n:=n+1;
writeln(n);
m:=n;
while m<=n do
begin
s:=s-[m];
m:=m+n;
end;
until s=[ ]; write(n,m);
end.