Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread Leandro Moreira
thanks mand On Friday, February 1, 2013 12:41:44 AM UTC-2, Zack Maril wrote: > > Take a look at this gist: > https://gist.github.com/4688693 > > It uses memoize to eek out a little bit more performance. > λ ~/Projects/experiments/collatz > lein run > Compiling collatz.core > [9 19] > "Elapsed time

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread Leandro Moreira
thanks On Friday, February 1, 2013 8:08:20 AM UTC-2, Alan Malloy wrote: > > (max-key :power mario luigi) > > On Thursday, January 31, 2013 6:08:21 PM UTC-8, Leandro Moreira wrote: >> >> Running through this problem I also faced the weird situation, so: >> >> Given two maps >> (def mario {:color "r

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread AtKaaZ
amalloy, inspirational as always! thank you On Fri, Feb 1, 2013 at 11:08 AM, Alan Malloy wrote: > (max-key :power mario luigi) > > > On Thursday, January 31, 2013 6:08:21 PM UTC-8, Leandro Moreira wrote: >> >> Running through this problem I also faced the weird situation, so: >> >> Given two ma

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread Alan Malloy
(max-key :power mario luigi) On Thursday, January 31, 2013 6:08:21 PM UTC-8, Leandro Moreira wrote: > > Running through this problem I also faced the weird situation, so: > > Given two maps > (def mario {:color "red" :power 45}) > (def luigi {:color "green" :power 40}) > > I want the max between b

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-01-31 Thread Leandro Moreira
Running through this problem I also faced the weird situation, so: Given two maps (def mario {:color "red" :power 45}) (def luigi {:color "green" :power 40}) I want the max between both but based on :power key. It would be something like this. (max mario luigi) I expect max return not only 45 bu

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-01-31 Thread Zack Maril
Take a look at this gist: https://gist.github.com/4688693 It uses memoize to eek out a little bit more performance. λ ~/Projects/experiments/collatz > lein run Compiling collatz.core [9 19] "Elapsed time: 30.236 msecs" [97 118] "Elapsed time: 5.532 msecs" [871 178] "Elapsed time: 22.529 msecs" [61

How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-01-31 Thread Leandro Moreira
The problem is known as Collatz Conjecture (also 3n + 1 conjecture). Basically given a n number then you apply the following rule. If n is even then n/2 otherwise 3 * n + 1, you keep applying this until you reach the number 1. For instance, starting with *n = 6*, one gets the sequence 6, 3, 10,