Computing unique index for every poker starting hand
As there are 52 cards in a deck we know there are 52 choose 2 = 1326 distinct matchups, however in preflop poker this can be bucketed into 169 different hands such as AK offsuit and AK suited as whether it is A hearts K hearts or A spade K spades it makes no difference preflop. My question is, is there a nice mathematical property in which I can uniquely index each of these 169 hands (from 0 to 168 preferably). I am trying to create a look up table as a double = new double  but have no way of changing a hand representation such as AKs (an Ace and a King of the same suit) to a unique index in this array.
- If the cards are of the same suit, sort the two cards, so that the lower card comes first. If they are of different suits, sort the two cards so that the lower card comes last. A special case will be reserved for when the cards are of the same rank and suit.
- Assign each rank a value from 0 to 12 and use a base-13 counting system. The highest value in this system is 12*13 + 12 = 168.
- Finally, for cases where both cards are of the same rank and suit, take the value of the rank and add 169 to it. These cases will be in the range 169-181.
Maybe my math is wrong, but I come up with 182 distinct pairs of cards. I'm no expert in the game, so maybe I'm missing something.
An example of a ready made Objective-C (and Java) Texas Hold'em 7- and 5-card evaluator can be found here and further explained here. It "adds" up hands to generate an index that sufficiently characterises the hand for determining rank.
All feedback welcome at the e-mail address found therein.