Using one deck of cards.

Taking into account different suites. However, the way they are arranged would not be accounted for. Ace of Spades and Queen of Diamonds would be the same as Queen of Diamonds and Ace of Spades.

Pictures (Jacks, Queens, Kings) = 10

Aces = 11, or 1

The way I see it, 21 can be split into:

20 + 1, 19 + 2, 18 + 3 ... 1 + 20. Each of those numbers can further be split down. It appears to be kind of recursive?

Then we have 2-card ways, 3-card ways, 4-card ways and so on ...

It seems to me a very, very tough problem and I have no idea how to approach it. Any ideas?

  • $\begingroup$ How many decks are in use, or can we assume there are an unlimited number of cards? $\endgroup$ Aug 19, 2016 at 3:58
  • $\begingroup$ Let us assume that there is one deck ... no repetitions of a card $\endgroup$
    – Jabrove
    Aug 19, 2016 at 4:01
  • $\begingroup$ You could if you really wanted to break it into cases: $2$ cards used, $3$ cards used, $4$ cards used... and in each break into cases further based on number of repeated values used... break into cases even further based on which numbers they actually are. There are for example $4\cdot \binom{16}{2}$ ways to have the points add up as $1+10+10$ while there are $4\cdot 4\cdot 4$ ways to have the points add up $6+7+8$. It seems to me that there would be a huge amount of brute force required to continue this way, but with the condition that no card can be repeated it might be unavoidable. $\endgroup$
    – JMoravitz
    Aug 19, 2016 at 4:41
  • $\begingroup$ math.stackexchange.com/questions/1461118/… $\endgroup$
    – MattW
    Aug 19, 2016 at 6:08
  • $\begingroup$ Perhaps we can come up with a computer algorithm to calculate this? $\endgroup$
    – Jabrove
    Aug 19, 2016 at 14:51

1 Answer 1


This Python code by @niemmi on Stack Overflow says that there are 186,184 ways.

import operator
from math import factorial

def bcoef(n, k):
    return factorial(n) / (factorial(k) * factorial(n - k))

def combinations(limit, start, used):
    if limit == 0:
        # For each face value figure out how many combinations can be used
        combs = (bcoef(4 if i != 10 else 16, x) for i, x in enumerate(used))
        res = reduce(operator.mul, combs, 1)
        return res

    res = 0
    for i in range(start, 12):
        if i > limit:

        index = i if i != 11 else 1

        if used[index] < 4:
            used[index] += 1
            res += combinations(limit - i, i, used)
            used[index] -= 1

    return res

print combinations(21, 1, [0] * 11) # 186184

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .