In a poker where each player gets 5 cards from a 32 card deck, I am trying to calculate how many subsets contain exactly one pair using Mathematica. I created a deck with four suits and created subsets of all possible combinations of the cards and now I am trying to filter out all the wrong combinations using different methods to exclude the four of a kind and three of a kind and the full house. but the filter is still showing higher values than it actually is. The out put of my program is "115584" but the actual result should be "107520". Is there a combination that i forgot to remove? here is the code
deck = Sort[Join[Range[7, 14], Range[7, 14], Range[7, 14], Range[7, 14]]]
hand = Subsets[deck, {5}]
SetAttributes[onePair, Orderless]
onePair [{x_, x_, y_, z_, w_} /; x != y != z != w] := True;
Count[hand, _?onePair]
I also tried the following code but the output is still not correct
onePair [{___, x_, x_, ___}] := True; (*we need two cards with same number but different suit*)
onePair [{___, x_, x_, x_, ___}] := False; (*this is to remove three of a kind*)
onePair[{___, x_, x_, y_, y_, ___} /; x != y] := False;(*to exclude the full house probability*)
onePair[{___}] := False;
Count[hand, _?onePair]