Re: Partition
- To: mathgroup at smc.vnet.net
- Subject: [mg22106] Re: Partition
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Mon, 14 Feb 2000 02:03:57 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <885iqv$a0a@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
(* just to count number of partitions *)
PartitionsP[5]
7
(* to generate the actual partitions *)
<<DiscreteMath`Combinatorica`
Partitions[5]
{{5}, {4, 1}, {3, 2}, {3, 1, 1}, {2, 2, 1}, {2, 1, 1, 1}, {1, 1, 1, 1,
1}}
Kai Xiu wrote:
>
> I am wondering how to do a partition work in Mathematica which is like
> give all the solutions of
> x_1+x_2+x_3+...+x_n=n
> where all x's are positive integers and not necessarily be different to each
> other.
>
> Thanks,
>
> Kai
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept. phone 413 549-1020 (H)
Univ. of Massachusetts 413 545-2859 (W)
Amherst, MA 01003-4515