program sieve; const MAX = 8192; var NUM, code, i, n, k, count: integer; flags : array[0..MAX] of boolean; begin NUM :=1; if ParamCount=1 then Val(ParamStr(1),NUM,code); for n:=1 to NUM do begin count := 0; fillChar(flags,sizeof(flags),True); for i := 2 to MAX do if flags[i] then begin inc(Count); k:=i+i; while k<=MAX do begin flags[k]:=false; inc(k,i); end; end; end; WriteLn('Count: ',Count); end.