How many different ways are there to get a 21 in Black Jack?












1












$begingroup$


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?










share|cite|improve this question











$endgroup$












  • $begingroup$
    How many decks are in use, or can we assume there are an unlimited number of cards?
    $endgroup$
    – Parcly Taxel
    Aug 19 '16 at 3:58










  • $begingroup$
    Let us assume that there is one deck ... no repetitions of a card
    $endgroup$
    – Kos
    Aug 19 '16 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 $4cdot binom{16}{2}$ ways to have the points add up as $1+10+10$ while there are $4cdot 4cdot 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 '16 at 4:41










  • $begingroup$
    math.stackexchange.com/questions/1461118/…
    $endgroup$
    – Matt Watkins
    Aug 19 '16 at 6:08










  • $begingroup$
    Perhaps we can come up with a computer algorithm to calculate this?
    $endgroup$
    – Kos
    Aug 19 '16 at 14:51
















1












$begingroup$


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?










share|cite|improve this question











$endgroup$












  • $begingroup$
    How many decks are in use, or can we assume there are an unlimited number of cards?
    $endgroup$
    – Parcly Taxel
    Aug 19 '16 at 3:58










  • $begingroup$
    Let us assume that there is one deck ... no repetitions of a card
    $endgroup$
    – Kos
    Aug 19 '16 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 $4cdot binom{16}{2}$ ways to have the points add up as $1+10+10$ while there are $4cdot 4cdot 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 '16 at 4:41










  • $begingroup$
    math.stackexchange.com/questions/1461118/…
    $endgroup$
    – Matt Watkins
    Aug 19 '16 at 6:08










  • $begingroup$
    Perhaps we can come up with a computer algorithm to calculate this?
    $endgroup$
    – Kos
    Aug 19 '16 at 14:51














1












1








1





$begingroup$


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?










share|cite|improve this question











$endgroup$




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?







permutations combinations card-games






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Aug 19 '16 at 4:02







Kos

















asked Aug 19 '16 at 3:39









KosKos

12517




12517












  • $begingroup$
    How many decks are in use, or can we assume there are an unlimited number of cards?
    $endgroup$
    – Parcly Taxel
    Aug 19 '16 at 3:58










  • $begingroup$
    Let us assume that there is one deck ... no repetitions of a card
    $endgroup$
    – Kos
    Aug 19 '16 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 $4cdot binom{16}{2}$ ways to have the points add up as $1+10+10$ while there are $4cdot 4cdot 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 '16 at 4:41










  • $begingroup$
    math.stackexchange.com/questions/1461118/…
    $endgroup$
    – Matt Watkins
    Aug 19 '16 at 6:08










  • $begingroup$
    Perhaps we can come up with a computer algorithm to calculate this?
    $endgroup$
    – Kos
    Aug 19 '16 at 14:51


















  • $begingroup$
    How many decks are in use, or can we assume there are an unlimited number of cards?
    $endgroup$
    – Parcly Taxel
    Aug 19 '16 at 3:58










  • $begingroup$
    Let us assume that there is one deck ... no repetitions of a card
    $endgroup$
    – Kos
    Aug 19 '16 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 $4cdot binom{16}{2}$ ways to have the points add up as $1+10+10$ while there are $4cdot 4cdot 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 '16 at 4:41










  • $begingroup$
    math.stackexchange.com/questions/1461118/…
    $endgroup$
    – Matt Watkins
    Aug 19 '16 at 6:08










  • $begingroup$
    Perhaps we can come up with a computer algorithm to calculate this?
    $endgroup$
    – Kos
    Aug 19 '16 at 14:51
















$begingroup$
How many decks are in use, or can we assume there are an unlimited number of cards?
$endgroup$
– Parcly Taxel
Aug 19 '16 at 3:58




$begingroup$
How many decks are in use, or can we assume there are an unlimited number of cards?
$endgroup$
– Parcly Taxel
Aug 19 '16 at 3:58












$begingroup$
Let us assume that there is one deck ... no repetitions of a card
$endgroup$
– Kos
Aug 19 '16 at 4:01




$begingroup$
Let us assume that there is one deck ... no repetitions of a card
$endgroup$
– Kos
Aug 19 '16 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 $4cdot binom{16}{2}$ ways to have the points add up as $1+10+10$ while there are $4cdot 4cdot 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 '16 at 4:41




$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 $4cdot binom{16}{2}$ ways to have the points add up as $1+10+10$ while there are $4cdot 4cdot 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 '16 at 4:41












$begingroup$
math.stackexchange.com/questions/1461118/…
$endgroup$
– Matt Watkins
Aug 19 '16 at 6:08




$begingroup$
math.stackexchange.com/questions/1461118/…
$endgroup$
– Matt Watkins
Aug 19 '16 at 6:08












$begingroup$
Perhaps we can come up with a computer algorithm to calculate this?
$endgroup$
– Kos
Aug 19 '16 at 14:51




$begingroup$
Perhaps we can come up with a computer algorithm to calculate this?
$endgroup$
– Kos
Aug 19 '16 at 14:51










1 Answer
1






active

oldest

votes


















0












$begingroup$

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:
break

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





share|cite|improve this answer









$endgroup$













    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "69"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1896777%2fhow-many-different-ways-are-there-to-get-a-21-in-black-jack%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0












    $begingroup$

    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:
    break

    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





    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      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:
      break

      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





      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        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:
        break

        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





        share|cite|improve this answer









        $endgroup$



        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:
        break

        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






        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Aug 26 '16 at 0:51









        KosKos

        12517




        12517






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1896777%2fhow-many-different-ways-are-there-to-get-a-21-in-black-jack%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents