Re: Generating r-combination or r-permutations with replacement.
- To: mathgroup at smc.vnet.net
- Subject: [mg51262] Re: Generating r-combination or r-permutations with replacement.
- From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
- Date: Mon, 11 Oct 2004 01:25:21 -0400 (EDT)
- References: <ckajd2$m4p$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Here is a way of doing what you want: <<DiscreteMath`Combinatorica` KSubsets[{1,2,3,4},3] {{1,2,3},{1,2,4},{1,3,4},{2,3,4}} Steve Luttrell "phil" <enfo at ucla.edu> wrote in message news:ckajd2$m4p$1 at smc.vnet.net... > Is there an easy function in mathematica that generates a set/list that > consists of r-combinations or r-permutations with replacement? > > e.g. I want the set of all possible sets with 3 elements, with entries > from > {1,2,3,4}, and also the set of all possible unordered sets with 3 > elements, > with entries from {1,2,3,4}. > > Any help is appreciated, > > -Philip Lu > >