What is the best hand for each hand size?
5: 23457 (unsuited, of course) 6: 234578 7: 2345789 8: 2345789T 9: 2345789TQ 10: 2345789TQK 11: 2346789JQKA (!) 12: 22346789JQKA 13: 223346789JQKA 14: 2233446789JQKA 15: 22334466789JQKA (can't reintroduce the 5) 16: 223344667789JQKA
At 17 cards, the best hand must contain a flush! The pigeonhole principle says that one suit must have at least 5 cards at this point. That frees us up enormously to include straights or high pairs, and so more than one hand will make the nuts (but we must be careful to exclude full houses.) But this tightens up a lot as the suited portions of the hand contain more cards.
17: 23457s 89TJQ KA234 57, for example, but there are many others 18: 23457s 23457s 689TJ QKA (and similiar) 19: 234578s 23457s 689TJ QKA (etc.) 20: 234578s 234578s 99TTJJQQ (66KKAA may be used as well.) 21: 2345789s 234578s 9TTJJQQK 22: 2345789s 2345789s TTJJQQKK 23: 2345789Ts 2345789s TJJQQKKA 24: 2345789Ts 2345789Ts 66JJQQKK 25: 2345789TQs 2345789Ts 66JJQKKA 26: 2345789TQs 2345789TQs 66JJKKAA (unique again up to choice of suits)
26 cards is half the deck. Note that if you have this hand your opponent must too. At what point do card-deletion effects come into play to the extend that we can easily identify an automatic winner?
With 27 cards or more you and your opponent(s) have to be playing from separate decks but we can continue with the math anyway. At this point the pigeonhole principle strikes again, we must have at least three of one rank. In fact, we have to make a full house.
27: 22233 44556 67788 99TTJ JQQKK AA (deuces full of aces) 28: 22233 34455 66778 899TT JJQQK KAA (treys full of aces) 29: 22233 34445 56677 8899T TJJQQ KKAA (fours full) ... 38: 22233 34445 55666 77788 8999T TTJJJ QQQKK KAA (kings full of aces) 39: 22233 34445 55666 77788 8999T TTJJJ QQQKK KAAA (aces full of kings)
At 40 cards we have to make quads (40/13 = 3.077)
40: 22223 33444 55566 67778 88999 TTTJJ JQQQK KKAAA (quad deuces)
Double-check: can we avoid making a straight flush? Yes, we just need to ensure that one suit is missing in each of A345 and 3456 (and all the other trips, of course.) Because there are 12 ranks left, the pattern matches up:
Rank: A23456789TJQK Missing suit: c dhscdhscdhs
No suit is present in five consecutive ranks. But that means we run into trouble right away, because 22223333444555666 must contain a straight flush; we can only block three suits, not four, from 444555666. We have to take the 5's out. But then consider 66667777888999TTT, which has the same problem. So we have to eliminate T's as well.
41: 22223 33344 44666 67777 88889 999JJ JJQQQ KKKAA A (quad J's) 42: 22223 33344 44666 67777 88889 999JJ JJQQQ QKKKA AA (quad Q's) 43: 22223 33344 44666 67777 88889 999JJ JJQQQ QKKKK AAA (quad K's) 44: 22223 33344 44666 67777 88889 999JJ JJQQQ QKKKK AAAA (quad A's)
Finally at 45 cards we have to make at least a straight flush (at least one suit must contain 12 cards.) We know that at 49 through 52 cards we have to make a royal flush. The best we can do is introduce the 5's back in and make 9-high straight flushes for 45 through 48 cards.