Created
January 13, 2015 02:17
-
-
Save djtrack16/d8a24164f702e9f04142 to your computer and use it in GitHub Desktop.
all prime factors of n
This file contains 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
(fn primeFactors | |
([n] (primeFactors n 2)) | |
([n div] | |
(cond | |
(< n div) '() | |
(zero? (mod n div)) (cons div (lazy-seq (primeFactors (/ n div) div))) | |
:else (recur n (inc div))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment