{$debug-}
program prime(output);
procedure time(var s:string); extern;

const	size = 8190;

var	flags : array[0..size] of boolean;
	i,prime,k,count,iter : integer;
	start_time,end_time : string(8);

begin
	writeln('10 iterations');
	time(start_time);
	writeln('Started at ',start_time);
	for iter := 1 to 10 do begin
	  count := 0;
	  for i := 0 to size do
	     flags[i] := true;
	  for i := 0 to size do
	     if flags[i] then begin
		prime := i+i+3;
		{writeln(prime);}
		k := i+prime;
		while k <= size do begin
		   flags[k] := false;
		   k := k + prime;
		end;
		count := count+1;
	     end;
	end;
	time(end_time);
	writeln('Finished at ',end_time);
	writeln(count,' Primes')
end.
