Bueno, aquí te dejo un poco de código:
Código Delphi
[-]
function EsPrimo(n: integer): boolean;
var
i: integer;
begin
Result:= FALSE;
for i:= 2 to Trunc(sqrt(n)) do
if n mod i = 0 then
Exit;
Result:= TRUE;
end;
procedure Primos(n: integer);
var
i: integer;
begin
i:= 1;
while n > 0 do
begin
if EsPrimo(i) then
begin
dec(n);
ShowMessage(IntToStr(i)); end;
inc(i);
end;
end;