Looks like you want to generate all the unordered combinations of three items taken two at a time, see Weisstein, Eric W. "Combination." From MathWorld --A Wolfram Web Resource. http://mathworld.wolfram.com/Combination.html You don't need any complicated function to do this just, create...