function CheckPrime(Number: Cardinal): boolean;
var i: Cardinal;
begin
result := false;
if Number < 3 then exit;
for i := 2 to trunc(sqrt(Number) + 1) do
if frac(Number / i) = 0.0 then exit;
result := true;
end;
// Beispielaufruf
procedure TForm1.Button1Click(Sender: TObject);
begin
if CheckPrime(4294967291) then showmessage('Primzahl')
else showmessage('Keine Primzahl');
end;