Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* Returns whether n is prime.
- Requires: n is a positive integer. *)
- fun isPrime(n: int): bool =
- let fun noDivisorsAbove(m: int) =
- if n mod m = 0 then false
- else if m*m >= n then true
- else noDivisorsAbove(m+1)
- in
- noDivisorsAbove(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement