Last active
          May 18, 2022 02:20 
        
      - 
      
- 
        Save kohyama/5b47be8255c1eb859f16 to your computer and use it in GitHub Desktop. 
Revisions
- 
        kohyama revised this gist Sep 29, 2015 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ (defn factorize [n] ((fn f [n [h & r :as ps]] (cond (< n 2) '() (zero? (mod n h)) (cons h (lazy-seq (f (quot n h) ps))) :else (recur n r))) n prime-numbers))) 
- 
        kohyama created this gist Sep 29, 2015 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ (defn factorize [n] (if-not (< 1 n) '() (let [p (first (drop-while #(pos? (mod n %)) prime-numbers))] (if (= p n) `(~n) (cons p (lazy-seq (factorize (quot n p))))))))