Sunday Times Teaser 3297 – 6oker
by Stephen Hogg
Published Sunday November 30 2025 (link)
6oker is a 6-card version of poker. Like 5-card poker the rank of a hand is based on the number of distinct variants of that type possible from a 52-card pack. Fewer variants gives a higher (winning) rank. For example, a running flush (A2345 to 10JQKA in one suit) has 40 variants, beating four-of-a-kind (eg, four aces with another card) which has 624 variants.
Playing 6oker, Al and Di held hands of different rank. Each comprised only two card values and no aces, jacks, queens or kings (eg, four 3s and two 6s). These four values had no common prime factors. Ignoring suits, if you were told just Al’s hand you couldn’t be sure of Di’s, but if you were told just Di’s you could be sure of Al’s.
Who won? Ignoring suits, give Al’s hand.
-
John Z. permalink12345678910111213141516171819202122232425262728293031323334from itertools import combinationsfrom math import gcdfrom collections import defaultdicthands = defaultdict(list)# get four values from 2 -- 9for fc in combinations(range(2, 11), 4):# These four values had no common prime factors.if all(gcd(a, b) == 1 for a, b in combinations(fc, 2)):# if one hand holds 2 cards, what cards can be in the opposite hand?for hand in combinations(fc, 2):ohand = tuple(sorted(set(fc) - set(hand)))hands[hand].append(ohand)# populate AL's possible hands: choose those with only one possible opp. handAL = defaultdict(list)for i in hands.items():if len(i[1]) == 1:AL[i[1].pop()].append(i[0])assert(len(AL) == 1)print("Al's hand must contain:", *[a[0] for a in AL.items()])print("Di's hand contains one of the following pairs",*[a[1] for a in AL.items()])# The two hands must be of distinct rank. If Di's hand is 3 + 3 then Al must be# 4 + 2 but we don't know if its 4 5's and two 2 7's or 4 7's and two 5's# So Di must have 4 + 2 which leaves Al with 3 5's and 3 7's. Di wins because# 4 2's beat 3 7's. This is a bit tedious to code so:print('Di Wins; Al has 3 each of', *[a[0] for a in AL.items()])