You're right. Hope I haven't offended with the fail, I thought I had tested it - by iterating over a range and comparing it to Uncle Bob's but obviously I didn't do that right and then realized that factorization is likely not O(n) anyway. I'll probably take more time next time.
Regards, Russell On Sat, Jun 12, 2010 at 5:11 AM, Steve Purcell <st...@sanityinc.com> wrote: > On 11 Jun 2010, at 20:35, Russell Christopher wrote: > > > didn't need the assoc in my previous try > > > > (defn of [n] > > (letfn [(f [res k] > > (if (= 0 (rem (:n res) k)) > > {:n (/ (:n res) k) :fs (conj (:fs res) k)} > > res))] > > (:fs (reduce f {:n n :fs []} (range 2 n))))) > > > The two give different answers. Given n=144, your version produces [2 3 4 > 6] and Uncle Bob's produces [2 2 2 2 3 3]. > > -Steve > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en