Last active
August 27, 2015 17:25
-
-
Save eshamster/db02f551d3c8a8dfb27e to your computer and use it in GitHub Desktop.
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
(defun factorize-in-prime (target &key (prime-series *prime-series*)) | |
(if (eq target 1) | |
(return-from factorize-in-prime nil)) | |
(let ((factor (lcar prime-series))) | |
(cons (loop while (= (mod target factor) 0) | |
count t | |
do (setf target (/ target factor))) | |
(factorize-in-prime target :prime-series (lcdr prime-series))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment