Skip to content

Instantly share code, notes, and snippets.

@shewu
Created September 30, 2009 13:56
Show Gist options
  • Save shewu/198109 to your computer and use it in GitHub Desktop.
Save shewu/198109 to your computer and use it in GitHub Desktop.
(defn isPrime?[x]
(loop [i 2 a 0]
(if (and (< a 1) (<= i (Math/sqrt x)))
(if (zero? (rem x i))
(recur (inc i) (inc a))
(recur (inc i) a))
(if (zero? a)
true
false))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment