On Feb 14, 11:13 pm, Andreas Kostler
<andreas.koestler.le...@gmail.com> wrote:
> Does anyone wanna have a look at my solution for Project Euler Problem 28?
>
> (defn diagonal-sum [n-max]
>         (+ 1 (reduce +
>                 (map (fn[n]
>                       (reduce + (map #(- (* n n) (* % (- n 1))) (range 4))))
>                      (take-nth 2 (range 3 (+ 2 n-max)))))))

For the record, here is my, more analytical, solution:
https://github.com/zuber/project-euler/blob/master/src/com/stepniowski/euler_028.clj

It runs in ~0.1 msecs on a 2.4 Ghz MacBook Pro.


Cheers,
--
Marek Stępniowski
http://stepniowski.com

-- 
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

Reply via email to