[Haskell-cafe] faster factorial function via FFI?
Dan Drake
haskell-cafe at dandrake.org
Tue Apr 24 09:53:03 EDT 2007
On Mon, 23 Apr 2007 at 04:36PM -0700, Stefan O'Rear wrote:
> > I'm finding the number of set partitions that correspond to a certain
> > integer partition. If p = p_1, p_2,...,p_k is an integer partition of n,
> > then there are
> >
> > n!
> > ----------------------------------------------
> > p_1! * p_2! * ... * p_k! * 1^c_1 * ... * k^c_k
>
> That formula isn't even correct. Consider p = replicate n 1, that is
> n partitions each of size 1. There is only one way to do this - put
> each element in its own partition. However, your formula gives:
Correct, the formula is incorrect. :) The "i^c_i" terms need to be
c_i!.
(I got it right in my code, though.)
Dan
--
Ceci n'est pas une .signature.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070424/e5132eff/attachment-0001.bin
More information about the Haskell-Cafe
mailing list