# On Sixes And Sevens

You will recall that the Baron's wagers involved dealing out a single suit of cards, six for Sir R----- and seven for himself. In the first Sir R----- would receive twice the face value plus one coins for each card from the Baron who would in his turn take twice the face value less one from Sir R-----. In the second the Baron would have three of Sir R-----'s coins if his total score were the greater and Sir R----- would have seven of the Baron's otherwise.

Now figuring the average payoffs for such games is complicated by the fact that each card can only be drawn once. If we consider dealing the Baron's hand first there are thirteen possible outcomes for the first card, but only twelve for the second and eleven for the third, et cetera.
The total number of possible hands that the Baron might draw is therefore given by
$13 \times 12 \times \dots \times 7 = \frac{13!}{6!}$
where the exclamation point stands for the factorial.
This is known as the number of permutations and, if we were to choose $$r$$ from $$n$$ items, is written as
$^nP_r = \frac{n!}{(n-r)!}$
In the case of the Baron's wager this equates to 8,648,640 possible outcomes and adding up the payoffs for each of them would be a daunting prospect indeed!
Fortunately a simple observation greatly simplifies the calculation for the first wager. Specifically, the universe of possibilities for the Baron's first six cards must be identical to that of Sir R-----'s entire hand; they are both six cards dealt at random after all!
If we denote the average sum of a deal of $$n$$ cards with $$s_n$$ then the Baron's expected prize is
$2 \times s_6 - 6 + 2 \times s_1 - 1$
and Sir R-----'s is
$2 \times s_6 + 6$
We should consequently expect the Baron's bounty to exceed Sir R-----'s by
$\left(2 \times s_6 - 6 + 2 \times s_1 - 1\right) - \left(2 \times s_6 + 6\right) = 2 \times s_1 - 13$
so we need only concern ourselves with the expected value of a single card chosen at random which is trivially given by
\begin{align*} s_1 &= \frac{1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + J(10) + Q(10) + K(10)}{13}\\ &= \frac{85}{13}\\ &= 6 \frac{7}{13} \end{align*}
We should therefore expect the Baron to come out ahead by
$2 \times 6 \frac{7}{13} - 13 = 13 \frac{1}{13} - 13 = \frac{1}{13}$
so my counsel for Sir R----- would have been to decline this wager.

Now for the second wager, despite its simpler manner of play, I could not figure any such tricks to simplify the calculation of the payoff. One point worth noting however, is that for both wagers the order in which the cards were counted would have had no impact upon the outcome.
We could therefore have chosen any of the seven cards to count first, then any of the six remaining to count second and so on. As a result we need only consider hands sorted in increasing order, reducing the number we need consider by a factor of $$7!$$ to $$1,716$$.
This number of ways we can choose $$r$$ from $$n$$ items if we don't care about their order is known as the number of combinations and is written as
$^nC_r = \frac{n!}{r! \times (n-r)!}$
To enumerate every possible combination without missing any out might seem rather a tall order given their number, but fortunately there is a simple, if not particularly efficient, scheme for doing so.
If we write out a number in binary rather than decimal we can associate each item with one of the digits and divide them into included and excluded groups according to whether it holds a one or a zero. Naturally, we should skip any numbers that do not have the requisite numbers of set or unset bits.
For example, if we assign unset bits to the Baron and set bits to Sir R----- we can equate
$1862 = 0011101000110$
as a hand for Sir R----- of

and one for the Baron of

Armed with this simple scheme, together with a good supply of candles and coffee, my fellow students and I resolved to work through the night evaluating every possible combination of cards in order to figure Sir R-----'s chances.

Program 1: Figuring The Second Wager

By daybreak we had determined that Sir R----- had 506 chances in 1716 possible hands of winning 7 coins and, consequently, 1210 chances of losing 3. His expected winnings were therefore
$7 \times \frac{506}{1716} - 3 \times \frac{1210}{1716} = -\frac{22}{429} = -\frac{2}{39}$
and, once again, I could not in good conscience have advised him to take the wager.

After some much needed rest I realised that I had missed a trick to make much shorter work of our reckoning. Specifically, that since the game does not distinguish between the ten, the Jack, the Queen and the King then neither should have we.
To avoid doing so we must divide the set of combinations into subsets $$S_i$$ in which the Baron had been dealt $$i$$ of the four of them and $$7-i$$ of the remaining nine cards, each of which contains the number of ways to choose the former multiplied by the number of ways to choose the latter, ignoring the order of choice in both cases, so that
\begin{align*} \left|S_0\right| &= {}^4C_0 \times {}^9C_7 = \frac{4!}{0! \times 4!} \times \frac{9!}{7! \times 2!} = 1 \times 36 = 36\\ \left|S_1\right| &= {}^4C_1 \times {}^9C_6 = \frac{4!}{1! \times 3!} \times \frac{9!}{6! \times 3!} = 4 \times 84 = 336\\ \left|S_2\right| &= {}^4C_2 \times {}^9C_5 = \frac{4!}{2! \times 2!} \times \frac{9!}{5! \times 4!} = 6 \times 126 = 756\\ \left|S_3\right| &= {}^4C_3 \times {}^9C_4 = \frac{4!}{3! \times 1!} \times \frac{9!}{4! \times 5!} = 4 \times 126 = 504\\ \left|S_4\right| &= {}^4C_4 \times {}^9C_3 = \frac{4!}{4! \times 0!} \times \frac{9!}{3! \times 6!} = 1 \times 84 = 84 \end{align*}
where the vertical bars stand for the number of elements within the sets that they enclose.
Now, since the sum of every card is $$85$$ the Baron should have won if the sum of his, which we shall call $$s_b$$, satisfied
\begin{align*} s_b &> 85-s_b\\ 2 \times s_b &> 85\\ s_b &\geqslant 43 \end{align*}
Since the greatest total that he could have had from the combinations in $$S_0$$ is
$9+8+7+6+5+4+3 = 42$
he could not have won the game had he not been dealt at least one of the ten point cards.
Similarly, for the combinations in $$S_4$$, his least total should have been
$10+10+10+10+3+2+1 = 46$
and he could not have lost!

In the games represented by the elements of $$S_1$$ the Baron would have been dealt one ten point card and we can define the sum of his remaining six cards as
$s_b^\prime = s_b - 10$
which must satisfy
\begin{align*} s_b^\prime+10&\geqslant 43\\ s_b^\prime&\geqslant 33 \end{align*}
if he were to emerge victorious. Noting that
\begin{align*} 7+6+5+4+3+2 &= 27\\ 8+7+6+5+4+3 &= 33 \end{align*}
we can see that he must also, at the very least, have been dealt from three to eight to have done so. Had he also been dealt a nine, then we can define the sum of his other five cards as
$s_b^{\prime\prime} = s_b^\prime-9 = s_b - 19$
which should have given him the game if
\begin{align*} s_b^{\prime\prime}+19&\geqslant 43\\ s_b^{\prime\prime}&\geqslant 24 \end{align*}
Further noting that the maximum score that he might have had if his next largest card were a six was
$6+5+4+3+2 = 20$
we may conclude that he must also have been dealt at least a seven in which case, since
\begin{align*} 7+6+5+4+3 &= 25\\ 7+6+5+4+2 &= 24 \end{align*}
he had only two winning combinations. Had his next largest card instead been an eight then the sum of his last four should have been given by
$s_b^{\prime\prime\prime} = s_b^{\prime\prime}-8 = s_b-27$
yielding a win if
\begin{align*} s_b^{\prime\prime\prime}+27&\geqslant 43\\ s_b^{\prime\prime\prime}&\geqslant 16 \end{align*}
Given that
$5+4+3+2 = 14$
the Baron could only have prevailed if he had next had a six or a seven. If it were a six then his next must have been a five since
$6+4+3+2 = 15$
Enumerating such deals, we have
\begin{align*} 6+5+2+1 &= 14 & 6+5+3+1 &= 15 & 6+5+3+2 &= 16\\ 6+5+4+1 &= 16 & 6+5+4+2 &= 17 & 6+5+4+3 &= 18 \end{align*}
yielding four wins. If it were a seven then we first have the case
$7+6+2+1 = 16$
and so all $$^5C_2$$, equalling ten, combinations in which the next was a six are wins. Next, we have
\begin{align*} 7+5+2+1 &= 15\\ 7+5+3+1 &= 16 \end{align*}
and so all but one of the $$^4C_2$$ combinations that also include a five, totalling five, yield victory. Finally we have
$7+4+3+2 = 16$
which is the only win if the next largest card is less than five.
Adding all of these cases together yields twenty three wins for the Baron for each of the four tens in $$S_1$$, giving a total of ninety two.

Now, in $$S_3$$ the Baron had three tens and so would have prevailed if the remaining four cards summed to
$s_b^\prime = s_b - 30 \geqslant 13$
which is only not the case for
\begin{align*} 4+3+2+1 &= 10 & 5+3+2+1 &= 11\\ 5+4+2+1 &= 12 & 6+3+2+1 &= 12 \end{align*}
and so it contains
${}^4C_3 \times \left({}^9C_4 - 4\right) = 4 \times (126 - 4) = 488$
winning combinations.

Lastly, in $$S_2$$ the Baron required the sum of his five spare cards to satisfy
$s_b^\prime = s_b - 20 \geqslant 23$
meaning that he must at least have had a seven since
$6+5+4+3+2 = 20$
and that it must have been accompanied by a six and a five since
\begin{align*} 7+5+4+3+2 &= 21\\ 7+6+4+3+2 &= 22 \end{align*}
Evaluating every such combination yields
\begin{align*} 7+6+5+2+1 &= 21 & 7+6+5+3+1 &= 22 & 7+6+5+3+2 &= 23\\ 7+6+5+4+1 &= 23 & 7+6+5+4+2 &= 24 & 7+6+5+4+3 &= 25 \end{align*}
of which four are victories. Now let us assume that he had been dealt an eight so that the sum of his four remaining cards should have satisfied
$s_b^{\prime\prime} = s_b^\prime - 8 \geqslant 15$
if he were to have prevailed. Given that
$5+4+3+2=14$
he would have also required a six or a seven. With a six we have
$6+4+3+2 = 15$
for success and, should the next highest card have been a five
\begin{align*} 6+5+2+1 &= 14\\ 6+5+3+1 &= 15\\ \end{align*}
so that all but one of the $$^4C_2$$ such combinations should have been a win, for a total of five. With a seven we find that
\begin{align*} 7+3+2+1 &= 13\\ 7+4+2+1 &= 14\\ 7+4+3+1 &= 15 \end{align*}
so that there are $$^6C_3-2$$, being eighteen, winning deals. Finally, if he had been dealt a nine then he needed his four last cards to instead have satisfied
$s_b^{\prime\prime} = s_b^\prime - 9 \geqslant 14$
of which combinations there is one case of victory with a five being the next greatest card
$5+4+3+2 = 14$
If it were a six then we have
\begin{align*} 6+3+2+1 &= 12 & 6+4+2+1 &= 13\\ 6+4+3+1 &= 14 & 6+5+2+1 &= 14 \end{align*}
and consequently there are $$^5C_3-2$$, or eight, such winning outcomes. In the case of a seven then he could instead have scored at least
\begin{align*} 7+3+2+1 &= 13\\ 7+4+2+1 &= 14 \end{align*}
for $$^6C_3-1$$, totalling nineteen, wins. In the last eventuality he should have also have had an eight and his least score should have been
$8+3+2+1 = 14$
and so in all $$^7C_3$$, equalling thirty five, such combinations the Baron would have prevailed.
Summing these we have ninety one wins for the Baron for each of the six ways that he might have been dealt two cards with a value of ten points, giving five hundred and forty six victorious combinations in $$S_2$$.

Adding together all of his winning outcomes we again find that they number
$0 + 84 + 92 + 488 + 546 = 1210$
Whilst it has taken a good while longer to explain this line of reasoning I swear that it took a good while shorter to follow it!
$$\Box$$