On Feb 3, 12:54 pm, Curtis Gagliardi <gagliardi.cur...@gmail.com>
wrote:
> I took your version Feng and used rem instead of mod and added a type hint
> and got down from:
> 23217.321626 => 11398.389942
>
> No idea where to go from here though.  I'm surprised there's such a
> difference even not using any sort of collection.
>
> (defn smallest-multiple-of-1-to-n-hinted-rem
>   [^long n]
>   (loop [i n]
>     (if (loop [d 2]
>           (cond (> d n) true
>                 (not= 0 (rem i d)) false
>                 :else (recur (inc d))))
>       i
>       (recur (inc i))))

I was able to shave off some more by writing (not= 0 (rem i d)) as (<
0 (rem i d)).

Shantanu

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to