This algorithm (in Pascal) returns True, if x is a prime number, and
returns False, if x isn't prime.

function Prime(x: word): boolean;
var i: word;
     v: boolean;
Begin
     v := False;
     if x=1 then v := True;
     for i:=2 to round(sqrt(x)) do Begin
          if x mod i = 0 then v := True;
     End;
     Prime := not v;
End;


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to