# Combinatorics puzzle

I am having a problem dealing with following topic:

lets say we have set of numbers n = [ 1 2 2 3 ] and we want be able to get all two-elementary combinations out of that(1.) and remove all repetitions(2.).

1.) Using combination formula n!/(k! (n - k)!) we end up having 6 pairs

([1 2], [1 2], [1 3], [2 2], [2 3], [2 3])


2.) Now I do not know how to compute amount of repetitions I need to get rid of ([1 2], [2 3]) to get clean set of 4 elements ([1 2], [1 3], [2 2], [2 3]).

Can someone explain me how to deal with these problems, please? I need to learn how algorithm works so I can create different size of subgroups from elements that may repeat.

P.S. it is important to result with a set of unique subgroups, not a quantity of them.

-

## 1 Answer

First count/enumerate all unordered pairs of different elements. That requires just knowing how many different elements that are in your original set.

Then take all the possible pairs of two identical elements. That's just a matter of checking which of your original elements have more than one copy.

Note that as soon as one of the original elements has two copies, adding more copies of it makes no difference.

-
thank You very much – kkris1983 Aug 21 '13 at 10:44