Re: Pairings
- To: mathgroup at smc.vnet.net
- Subject: [mg4538] Re: [mg4434] Pairings
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Wed, 7 Aug 1996 04:17:44 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Robert Pratt <rpratt at math.unc.edu> [mg4434] Pairings writes > I want a function that finds, given n, all pairings of Range[n] > excluding {1,2}, {2,3}, {n-2,n-1}, and {n-1,n}........ Robert: Needs["DiscreteMath`Combinatorica`"] DeleteCases[KSubsets[Range[7],2], {a_,b_}/;b==a+1]//Timing {0.05 Second, {{1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {2, 4}, {2, 5}, {2, 6}, {2, 7}, {3, 5}, {3, 6}, {3, 7}, {4, 6}, {4, 7}, {5, 7}} } Allan Hayes hay at haystack.demon.co.uk ==== [MESSAGE SEPARATOR] ====