[Haskell-cafe] Can anyone help me with partition numbers?
whoals (sent by Nabble.com)
lists at nabble.com
Thu Nov 24 11:00:24 EST 2005
A partition of a positive integer n is a representation of n as the sum of any number of positive integral parts. For example, there are 7 partitions of the number 5: 1+1+1+1+1, 1+1+1+2, 1+1+3, 1+2+2, 1+4, 2+3 and 5. Define a function parts which returns the list of distinct partitions of an integer n. For example, parts 4 = [[1,1,1,1],[1,1,2],[1,3],[2,2],[4]].
--
Sent from the Haskell - Haskell-Cafe forum at Nabble.com:
http://www.nabble.com/Can-anyone-help-me-with-partition-numbers--t612336.html#a1636292
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell-cafe/attachments/20051124/30c347cd/attachment.htm
More information about the Haskell-Cafe
mailing list