Prime factorization, with "tail recursion" (sort of: loop/recur in clojure)