Combinatorics question



Hi all, I have a problem regarding combinatorics. Let's see if I'm
capable of explaining myself correctly:

I have S distinct elements, from which I will pick four. So far, the
number of groups I can make up this way is C(S,4) or S! / {4!*(S -
4)!}.

Now, from those C(S,4) posibilities, I want to discard those which
share 3 elements, well just one of the two. Let's better put an
example:

I have the letters a,b,c,d,e,f (6 elements), and I can group them
together in groups of four in C(6,4)=15 ways:

abcd
abce
abcf
abde
abdf
abef
acde
acdf
acef
adef
bcde
bcdf
bcef
bdef
cdef

Now, I have to start to discard: "abce" is the first one to discard,
since "abc" already appeared on the first combination, and same with
"abcf". I also reject "abde" as "abd" appeared on the first
combination, "abdf" too. I'll mantain "abef" since it has only two
elements repeated with the first combination. Doing this for all
combinations, I end up with only three: "abcd", "abef" and "cdef".

So, I'd like to know if there's an easy way to know how many valid
combinations there are, and which ones they are. I'm aware that
depending on which one I start to compare from, I will end up with
different solutions, but I don't care about that. Any formula,
algorithm or help is much appreciated. Thanks in advance,

Keta
.