Fwd: List manipulation
- To: mathgroup at smc.vnet.net
- Subject: [mg7428] Fwd: [mg7390] List manipulation
- From: BobHanlon at aol.com
- Date: Sat, 31 May 1997 15:08:05 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
The function that you want is KSubsets within the standard package
DiscreteMath`Combinatorica`
Needs["DiscreteMath`Combinatorica`"]
data1 = Range[4]; data2 = Range[8];
KSubsets[data1, 3]
{{1,2,3},{1,2,4},{1,3,4},{2,3,4}}
Length[KSubsets[data2, 4]]
70
Bob Hanlon
---------------------
Forwarded message:
From: nandgopa at math.tifr.res.in (V. Nandagopal)
To: mathgroup at smc.vnet.net
To: mathgroup at smc.vnet.net
Hello,
I have a list X={1,2,3,4,5,6,7,8}. How do I get a list of the
folllowing kind:
S={{1,2,3,4}, {1,2,3,5}, {1,2,3,6}, .....}.
S will have 8-choose-2 = 70 elements. Each element of S should have length
4.
Is there any function which does such list making? Something of
the form
?????[list, n]
Thanks in advance.
V. Nandagopal
School of Mathematics
Tata Institute of Fundamental Research
Colaba, Bombay 400 005, India
e-mail: nandgopa at math.tifr.res.in