Re: Partition
- To: mathgroup at smc.vnet.net
- Subject: [mg22097] Re: Partition
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 14 Feb 2000 02:03:49 -0500 (EST)
- References: <885iqv$a0a@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Kai,
Some possibilities:
I
<< DiscreteMath`Combinatorica`
Partitions[4]
{{4}, {3, 1}, {2, 2}, {2, 1, 1}, {1, 1, 1, 1}}
Compositions[4, 2]
{{0, 4}, {1, 3}, {2, 2}, {3, 1}, {4, 0}}
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Kai Xiu" <kaixiu at students.uiuc.edu> wrote in message
news:885iqv$a0a at smc.vnet.net...
> 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
>
>