Last active
January 7, 2016 20:11
-
-
Save niksudan/6460fca8656d2a157593 to your computer and use it in GitHub Desktop.
Prime number checker [Clojure]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn prime? [n] | |
| (loop [i 2] | |
| (if (< i n) | |
| (if (not (integer? (/ n i))) | |
| (recur (+ i 1)) | |
| false | |
| ) | |
| true | |
| ) | |
| ) | |
| ) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Obviously not the most efficient, but it's what I could come up with first that worked