Re: Partition
- To: mathgroup at smc.vnet.net
- Subject: [mg22094] Re: [mg22091] Partition
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Mon, 14 Feb 2000 02:03:47 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
on 00.2.13 3:14 PM, Kai Xiu at kaixiu at students.uiuc.edu 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
>
>
In[11]:=
<< DiscreteMath`Combinatorica`
In[12]:=
Partitions[7]
Out[12]=
{{7}, {6, 1}, {5, 2}, {5, 1, 1}, {4, 3}, {4, 2, 1}, {4, 1, 1, 1}, {3, 3,
1}, {3, 2, 2}, {3, 2, 1, 1}, {3, 1, 1, 1, 1}, {2, 2, 2, 1}, {2, 2, 1, 1,
1}, {2, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1}}
--
Andrzej Kozlowski
Toyama International University
Toyama, Japan
http://sigma.tuins.ac.jp/