On 6/26/06, Matthew Moss <matthew.moss.coder / gmail.com> wrote:
> I had one more try... to see how small I could make the code without
> golfing it. This is pretty straightforward, and I thought the direct
> calculation of the binomial coefficients (given a cached factorial)
> would be faster than array manipulations, but somehow it's slower:

[snipped run-times]

> Not sure why it should be so slow, but offhand (without knowing how to
> function-level profile) it seems nearly all the time is spent in
> binom().

My guess:  When calculating binomials, you are running into bignum
territory much faster than iterating and summing.  Depending on your
machine, you may be getting up there at around 13! or perhaps 21!

May or may not be a problem, but it's a thought.


-- 
Lou.