Re: Combination List
- To: mathgroup at smc.vnet.net
- Subject: [mg78021] Re: Combination List
- From: "Sem" <sarner2006-sem at yahoo.it>
- Date: Thu, 21 Jun 2007 05:51:46 -0400 (EDT)
- References: <f55qci$k58$1@smc.vnet.net> <f58bk7$6ve$1@smc.vnet.net> <f5arsg$9aq$1@smc.vnet.net>
Did you mean this: In[1]:= Tuples[Range[4],3] Out[1]= {{1,1,1},{1,1,2},{1,1,3},{1,1,4},{1,2,1},{1,2,2},{1,2,3},{1,2,4},{1,3,1},{1,3, 2},{1,3,3},{1,3,4},{1,4,1},{1,4,2},{1,4,3},{1,4,4},{2,1,1},{2,1,2},{2,1, 3},{2,1,4},{2,2,1},{2,2,2},{2,2,3},{2,2,4},{2,3,1},{2,3,2},{2,3,3},{2,3, 4},{2,4,1},{2,4,2},{2,4,3},{2,4,4},{3,1,1},{3,1,2},{3,1,3},{3,1,4},{3,2, 1},{3,2,2},{3,2,3},{3,2,4},{3,3,1},{3,3,2},{3,3,3},{3,3,4},{3,4,1},{3,4, 2},{3,4,3},{3,4,4},{4,1,1},{4,1,2},{4,1,3},{4,1,4},{4,2,1},{4,2,2},{4,2, 3},{4,2,4},{4,3,1},{4,3,2},{4,3,3},{4,3,4},{4,4,1},{4,4,2},{4,4,3},{4,4, 4}} In[2]:= Length[%] Out[2]= 64 ? HTH, Sem "Bruno Campanini" <BC at gmail.com> news:f5arsg$9aq$1 at smc.vnet.net... > "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com> wrote in message > news:f58bk7$6ve$1 at smc.vnet.net... > >> I believe the last line is a typo (otherwise your request does not make >> any sense). > > Yes it is. > Thank you Jean-Marc and thanks to the other fellows. > I got a number of good solutions to my question. > > May I go on... > What if I can have one or more repeated elements in subsets? > That is the number of combinations of 3 elements out of 4 > - with one or more duplicated elements - is Binomial[4+3-1,3] = 20 > > How can I get the list? > > Bruno > >