how can I calculate the probability to get triples or better when throwing n 6-sided dice?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I've been banging my head on a wall with this question. I'm designing a game and would like to implement a loot system inspired by a game called "Vermintide" where players roll a certain number of dice and gain loot according to the result.



I want my players to get rewards depending on the result of the dice. but I need to evaluate the quality of items, and the number of dice they get to throw based on the probability.



Essentially if they get doubles they get a standard item, if they get triples they get a magic item etc...



I heard of the "birthday problem" and "multinomials" but most of what I could find about it seemed to be very particular cases (I found birthday problem for 2 or more but not for 3 or more, which seems much less trivial).



Is there a smart way to go about this problem which I first thought was going to be trivial, and the more I search the more it seems complicated.







share|cite|improve this question



















  • What does 'triples or better' mean precisely?
    – Stefan Mesken
    Jul 31 at 13:26










  • How many dice participate in one roll?
    – Vasya
    Jul 31 at 13:28










  • @StefanMesken Triples or better is 3 or more of a kind
    – user1747281
    Jul 31 at 13:43










  • @Vasya the number of dice is variable. I want to make an excel sheet with the probability for each number of dice But it's always going to be between 3 and 12
    – user1747281
    Jul 31 at 13:44







  • 1




    There is a.form at the bottom of this page that will do the calculation automatically, and the attached article explains how the calculation is done: blog.plover.com/math/yahtzee.html
    – MJD
    Jul 31 at 14:16














up vote
2
down vote

favorite












I've been banging my head on a wall with this question. I'm designing a game and would like to implement a loot system inspired by a game called "Vermintide" where players roll a certain number of dice and gain loot according to the result.



I want my players to get rewards depending on the result of the dice. but I need to evaluate the quality of items, and the number of dice they get to throw based on the probability.



Essentially if they get doubles they get a standard item, if they get triples they get a magic item etc...



I heard of the "birthday problem" and "multinomials" but most of what I could find about it seemed to be very particular cases (I found birthday problem for 2 or more but not for 3 or more, which seems much less trivial).



Is there a smart way to go about this problem which I first thought was going to be trivial, and the more I search the more it seems complicated.







share|cite|improve this question



















  • What does 'triples or better' mean precisely?
    – Stefan Mesken
    Jul 31 at 13:26










  • How many dice participate in one roll?
    – Vasya
    Jul 31 at 13:28










  • @StefanMesken Triples or better is 3 or more of a kind
    – user1747281
    Jul 31 at 13:43










  • @Vasya the number of dice is variable. I want to make an excel sheet with the probability for each number of dice But it's always going to be between 3 and 12
    – user1747281
    Jul 31 at 13:44







  • 1




    There is a.form at the bottom of this page that will do the calculation automatically, and the attached article explains how the calculation is done: blog.plover.com/math/yahtzee.html
    – MJD
    Jul 31 at 14:16












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I've been banging my head on a wall with this question. I'm designing a game and would like to implement a loot system inspired by a game called "Vermintide" where players roll a certain number of dice and gain loot according to the result.



I want my players to get rewards depending on the result of the dice. but I need to evaluate the quality of items, and the number of dice they get to throw based on the probability.



Essentially if they get doubles they get a standard item, if they get triples they get a magic item etc...



I heard of the "birthday problem" and "multinomials" but most of what I could find about it seemed to be very particular cases (I found birthday problem for 2 or more but not for 3 or more, which seems much less trivial).



Is there a smart way to go about this problem which I first thought was going to be trivial, and the more I search the more it seems complicated.







share|cite|improve this question











I've been banging my head on a wall with this question. I'm designing a game and would like to implement a loot system inspired by a game called "Vermintide" where players roll a certain number of dice and gain loot according to the result.



I want my players to get rewards depending on the result of the dice. but I need to evaluate the quality of items, and the number of dice they get to throw based on the probability.



Essentially if they get doubles they get a standard item, if they get triples they get a magic item etc...



I heard of the "birthday problem" and "multinomials" but most of what I could find about it seemed to be very particular cases (I found birthday problem for 2 or more but not for 3 or more, which seems much less trivial).



Is there a smart way to go about this problem which I first thought was going to be trivial, and the more I search the more it seems complicated.









share|cite|improve this question










share|cite|improve this question




share|cite|improve this question









asked Jul 31 at 13:16









user1747281

112




112











  • What does 'triples or better' mean precisely?
    – Stefan Mesken
    Jul 31 at 13:26










  • How many dice participate in one roll?
    – Vasya
    Jul 31 at 13:28










  • @StefanMesken Triples or better is 3 or more of a kind
    – user1747281
    Jul 31 at 13:43










  • @Vasya the number of dice is variable. I want to make an excel sheet with the probability for each number of dice But it's always going to be between 3 and 12
    – user1747281
    Jul 31 at 13:44







  • 1




    There is a.form at the bottom of this page that will do the calculation automatically, and the attached article explains how the calculation is done: blog.plover.com/math/yahtzee.html
    – MJD
    Jul 31 at 14:16
















  • What does 'triples or better' mean precisely?
    – Stefan Mesken
    Jul 31 at 13:26










  • How many dice participate in one roll?
    – Vasya
    Jul 31 at 13:28










  • @StefanMesken Triples or better is 3 or more of a kind
    – user1747281
    Jul 31 at 13:43










  • @Vasya the number of dice is variable. I want to make an excel sheet with the probability for each number of dice But it's always going to be between 3 and 12
    – user1747281
    Jul 31 at 13:44







  • 1




    There is a.form at the bottom of this page that will do the calculation automatically, and the attached article explains how the calculation is done: blog.plover.com/math/yahtzee.html
    – MJD
    Jul 31 at 14:16















What does 'triples or better' mean precisely?
– Stefan Mesken
Jul 31 at 13:26




What does 'triples or better' mean precisely?
– Stefan Mesken
Jul 31 at 13:26












How many dice participate in one roll?
– Vasya
Jul 31 at 13:28




How many dice participate in one roll?
– Vasya
Jul 31 at 13:28












@StefanMesken Triples or better is 3 or more of a kind
– user1747281
Jul 31 at 13:43




@StefanMesken Triples or better is 3 or more of a kind
– user1747281
Jul 31 at 13:43












@Vasya the number of dice is variable. I want to make an excel sheet with the probability for each number of dice But it's always going to be between 3 and 12
– user1747281
Jul 31 at 13:44





@Vasya the number of dice is variable. I want to make an excel sheet with the probability for each number of dice But it's always going to be between 3 and 12
– user1747281
Jul 31 at 13:44





1




1




There is a.form at the bottom of this page that will do the calculation automatically, and the attached article explains how the calculation is done: blog.plover.com/math/yahtzee.html
– MJD
Jul 31 at 14:16




There is a.form at the bottom of this page that will do the calculation automatically, and the attached article explains how the calculation is done: blog.plover.com/math/yahtzee.html
– MJD
Jul 31 at 14:16










4 Answers
4






active

oldest

votes

















up vote
2
down vote



accepted










In what follows I will refer to “pattern” in the dice rolls. For example the pattern AAABC means that three of the dice show the same number and the other two dice are different from the first three and also different from each other. The roll $1 2 2 4 2$ has this pattern, but $1 2 2 1 2$ does not; that has the pattern AAABB, and similarly $2 2 2 2 1$ is not patternAAABC but AAAAB.



There are seven patterns possible with five dice:



AAAAA
AAAAB
AAABB
AAABC

AABBC
AABCD
ABCDE


If you want three of a kind “or better” on five dice, you are interested in the sum of the first four patterns and you want to disregard the other three. What follows is an explanation of how to compute the probability for each pattern.



We will represent the patterns numerically like this: AAABC will be $(2, 0, 1)$ because there are two letters that appear once, no letters that appear twice, and one letter that appears three times. AAABB will be $(0, 1, 1)$ because there are no letters that appear once, one that appears twice, and one that appears three times. AABCD is $(3, 1)$ (we omit the trailing zero) and ABCDE is $(5)$. We'll refer to these numbers as $n_1, n_2, ldots$. For AAABC, we have $n_1 = 2, n_2 = 0, n_3 = 1$. For five dice, the representations of the seven patterns are:



$$beginarraylrrrrr
& n_1 & n_2 & n_3 & n_4 & n_5 \
AAAAA & 0 & 0 & 0 & 0 & 1 \
AAAAB & 1 & 0 & 0 & 1 \
AAABB & 0 & 1 & 1 \
AAABC & 2 & 0 & 1 \
AABBC & 1 & 2 \
AABCD & 3 & 1 \
ABCDE & 5
endarray
$$



Now suppose we're rolling $N$ dice each with $d$ sides. If there are $N$ dice, we should always have $sum icdot n_i = N$. We'll also take $k=sum n_i$; this is just the number of different letters in the pattern.



Then it transpires that the number of ways of rolling any pattern is:



$$
colormaroondchoose kcolordarkbluek!
colordarkgreenN!over colorpurpleprod i!^n_in_i!
$$



To get the probability, just divide by $d^N$.



I'll work through one example to demonstrate the formula. How many ways are there to roll the pattern AAABC, which is three of a kind, but not counting full house, for of a kind, or five of a kind. For AAABC we have $n_1=2, n_2=0, n_3 = 1$, so $k=n_1+n_2+n_3 = 3$, and the formula gives:



$$colormaroon6choose 3colordarkblue3!
colordarkgreen5!over colorpurple(1!^2cdot2!)(2!^0cdot0!)(3!^1cdot1!) =
colormaroon20cdot colordarkblue6cdot
colordarkgreen120over colorpurple2cdot1cdot6 = mathbf1200
$$



There are 1200 ways to roll the pattern AAABC, so the probability is $frac12006^5 approx 15.43%$. Similar calculations for the other three patterns of interest give:



$$beginarraylrrl
A A A B C & 1200 & 15.43 & % \
A A A B B & 300 & 3.86 \
A A A A B & 150 & 1.93 \
A A A A A & 6 & 0.08 \ hline
textTotal & 1656 & 21.30 & %
endarray
$$



So you can expect to get three of a kind or better around one time in five.



(By far the most common pattern is the single pair AABCD, which occurs almost half the time.)



I explained the formula in more detail in a blog post. This page tabulates the probabilities for every pattern of up to 12 dice. You program that generated these tables is available online: the URL



 https://perl.plover.com/misc/enumeration/tabulate-dice.cgi?N=7&S=11


generates a table for seven dice each with 11 sides. You can adjust the 7 and 11 to suit yourself. Related materials, including program source code, are available also.






share|cite|improve this answer























  • Confirmed by simulation (+1): If you sort the outcomes from 5 dice, you're asking for the longest run length to be at least three. In R, the function rle (for 'run length encoding') does most of the work: three lines of code: set.seed(731); m=10^5; die = 1:6, x=replicate(m,max(rle(sort(sample(die,5,rep=T)))$lengths)), and mean(x >= 3) return 0.21219, which matches your 0.213 within the margin of simulation error.
    – BruceET
    Aug 1 at 5:06











  • Is there a nice way to calculate $n_i$s ?
    – Jaroslaw Matlak
    Aug 1 at 8:42










  • @jaroslaw count the number of occurrences of each letter and store the counts in an array. Then count the occurrences of each value in the array and store those counts in a second array. The second array is $n$.
    – MJD
    Aug 1 at 12:34










  • I see, but is there a simple formula? Because for large $N$ (10,11,12) this array might be very big.
    – Jaroslaw Matlak
    Aug 1 at 12:45






  • 1




    Note that even for large $N$, you do not have to calculate all the patterns and store them. It is not hard to calculate them one at a time, each one from the previous, so that only one is in memory at any time. The Higher-Order Perl link above explains how to do this. Also, for $n=12, d=6$ there are 58 patterns, not 37.
    – MJD
    Aug 1 at 14:05


















up vote
0
down vote













If I understand your problem correctly, you're looking for a generalization of the binomial distribution to $n > 2$ where $n$ is the number of possible classes. The term for this is a multinomial distribution.



We can view a $n = 2$ side analog of a dice as a coin. The probability of a single outcome is a Bernoulli distribution (e.g. $Pr(H)$). The probability of multiple outcomes is a Binomial distribution (e.g. $Pr(HT)$).



For $n > 2$, the probability of a single outcome is a Categorical distribution (e.g. $Pr(1)$). The probability of multiple outcomes is a Multinomial distribution (e.g. $Pr(1126)$).



Remember that a multinomial distribution will only tell you the distribution of, say 5 of the rolls being $1$. So if you're looking for pairs or triplets regardless of the class -- whether its 1 or 2, you don't care -- you have to multiply your probability (if its a fair dice) or construct a sum in the case the dice is not fair.






share|cite|improve this answer




























    up vote
    0
    down vote













    Hint



    You can compute the probability of not getting triple. The number $f_n$ of possibilities of not getting triples in $n$ throws is:
    $$f_1 = binom61\
    f_2 = binom622!+binom61\
    f_3=binom633!+binom61binom51frac3!2!\
    f_4=binom644!+binom61binom52frac4!2!+binom62frac4!2!2!\
    f_5=binom655!+binom61binom53frac5!2!+binom62binom41frac5!2!2!\
    f_6=binom666!+binom61binom54frac6!2!+binom62binom42frac6!2!2!+binom63frac6!2!2!2!\
    f_7=binom61frac7!2!+binom62binom43frac7!2!2!+binom63binom31frac7!2!2!2!\
    f_8=binom62frac8!2!2!+binom63binom32frac8!2!2!2!+binom64frac8!2!2!2!2!\
    f_9=binom63frac9!2!2!2!+binom64binom21frac9!2!2!2!2!\
    f_10 = binom64frac10!2!2!2!2!+binom65frac10!2!2!2!2!2!\
    f_11=binom65frac11!2!2!2!2!2!\
    f_12=binom66frac12!2!2!2!2!2!2!$$
    For $k>13$ we have $f_k=0$



    The number of all possible throws $omega_n$ is:
    $$omega_n=6^n$$
    Now you can compute the probability of not getting triple:
    $$p_n=fracf_nomega_n$$
    and probability of getting triple:
    $$q_n=1-p_n$$






    share|cite|improve this answer























    • Thanks a lot for the suggestion. It does allow to solve the "triples" problem but not the "or better" part. Still pretty interesting take on the problem.
      – user1747281
      Jul 31 at 16:41










    • Actually this solution consider "or better" as a triple. $p_n$ denotes the number of events, where there at most pairs.
      – Jaroslaw Matlak
      Jul 31 at 21:36










    • What am I getting wrong? If $n=5,$ then $f_5 = 6+60+60=126$ and $omega_n = 252,$ so $q_n = p_n = .5.$ Which is already larger than @MJD's answer. (Seems exactly a triple has probability $approx 0.19.)$
      – BruceET
      Aug 1 at 5:24







    • 1




      @BruceET You're right - my answer was not complete (I comsidered each situation as one, while there are more possibilities of throwing AAABB for given A and B than AAAAA. I've edited my answer.
      – Jaroslaw Matlak
      Aug 1 at 8:37

















    up vote
    0
    down vote













    The OP is correct in saying that this is a generalization of the Birthday Problem and that it is harder because we are interested in cases where the number of people with the same birthday is greater than two. One approach is by way of exponential generating functions.



    Let's take a concrete example. Suppose we want to roll $10$ six-sided dice and find the probability that at least one number comes up $5$ or more times. It seems easier to consider the complementary event, i.e. all numbers come up $4$ or fewer times. There are $6^10$ possible sequences of die rolls, all of which we assume are equally likely. We would like to count the number of sequences in which no number comes up more than $4$ times. We generalize the problem a bit and think about a sequence of $n$ die rolls, and let the number of sequences in which no number appears more than $4$ times be $a_n$.



    The exponential generating function of $a_n$ is defined to be
    $$f(x) = sum_n=0^infty frac1n! a_n x^n$$
    Since each die has $6$ sides and each number appears no more than $4$ times,
    $$f(x) = left( sum_i=0^4 frac1i! x^i right)^6$$
    The number we want in our problem, $a_10$, is $10!$ times the coefficient of $x^10$ when $f(x)$ is expanded. I suppose a pencil and paper solution is possible, but I took the easy way out and used a computer algebra system to find that the coefficient of $x^10$ is $2177 / 144$. Therefore the number of sequences of $10$ die rolls in which no number appears more than $4$ times is $$a_10 = 10! times frac2177 144 = 54,860,400$$



    So the probability that no number appears more than $4$ times in $10$ rolls is
    $$p = fraca_106^10 = 0.907291$$
    and the probability that at least one number appears $5$ times or more is
    $$1-p = 0.0927093$$






    share|cite|improve this answer





















      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',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      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%2f2868036%2fhow-can-i-calculate-the-probability-to-get-triples-or-better-when-throwing-n-6-s%23new-answer', 'question_page');

      );

      Post as a guest






























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      In what follows I will refer to “pattern” in the dice rolls. For example the pattern AAABC means that three of the dice show the same number and the other two dice are different from the first three and also different from each other. The roll $1 2 2 4 2$ has this pattern, but $1 2 2 1 2$ does not; that has the pattern AAABB, and similarly $2 2 2 2 1$ is not patternAAABC but AAAAB.



      There are seven patterns possible with five dice:



      AAAAA
      AAAAB
      AAABB
      AAABC

      AABBC
      AABCD
      ABCDE


      If you want three of a kind “or better” on five dice, you are interested in the sum of the first four patterns and you want to disregard the other three. What follows is an explanation of how to compute the probability for each pattern.



      We will represent the patterns numerically like this: AAABC will be $(2, 0, 1)$ because there are two letters that appear once, no letters that appear twice, and one letter that appears three times. AAABB will be $(0, 1, 1)$ because there are no letters that appear once, one that appears twice, and one that appears three times. AABCD is $(3, 1)$ (we omit the trailing zero) and ABCDE is $(5)$. We'll refer to these numbers as $n_1, n_2, ldots$. For AAABC, we have $n_1 = 2, n_2 = 0, n_3 = 1$. For five dice, the representations of the seven patterns are:



      $$beginarraylrrrrr
      & n_1 & n_2 & n_3 & n_4 & n_5 \
      AAAAA & 0 & 0 & 0 & 0 & 1 \
      AAAAB & 1 & 0 & 0 & 1 \
      AAABB & 0 & 1 & 1 \
      AAABC & 2 & 0 & 1 \
      AABBC & 1 & 2 \
      AABCD & 3 & 1 \
      ABCDE & 5
      endarray
      $$



      Now suppose we're rolling $N$ dice each with $d$ sides. If there are $N$ dice, we should always have $sum icdot n_i = N$. We'll also take $k=sum n_i$; this is just the number of different letters in the pattern.



      Then it transpires that the number of ways of rolling any pattern is:



      $$
      colormaroondchoose kcolordarkbluek!
      colordarkgreenN!over colorpurpleprod i!^n_in_i!
      $$



      To get the probability, just divide by $d^N$.



      I'll work through one example to demonstrate the formula. How many ways are there to roll the pattern AAABC, which is three of a kind, but not counting full house, for of a kind, or five of a kind. For AAABC we have $n_1=2, n_2=0, n_3 = 1$, so $k=n_1+n_2+n_3 = 3$, and the formula gives:



      $$colormaroon6choose 3colordarkblue3!
      colordarkgreen5!over colorpurple(1!^2cdot2!)(2!^0cdot0!)(3!^1cdot1!) =
      colormaroon20cdot colordarkblue6cdot
      colordarkgreen120over colorpurple2cdot1cdot6 = mathbf1200
      $$



      There are 1200 ways to roll the pattern AAABC, so the probability is $frac12006^5 approx 15.43%$. Similar calculations for the other three patterns of interest give:



      $$beginarraylrrl
      A A A B C & 1200 & 15.43 & % \
      A A A B B & 300 & 3.86 \
      A A A A B & 150 & 1.93 \
      A A A A A & 6 & 0.08 \ hline
      textTotal & 1656 & 21.30 & %
      endarray
      $$



      So you can expect to get three of a kind or better around one time in five.



      (By far the most common pattern is the single pair AABCD, which occurs almost half the time.)



      I explained the formula in more detail in a blog post. This page tabulates the probabilities for every pattern of up to 12 dice. You program that generated these tables is available online: the URL



       https://perl.plover.com/misc/enumeration/tabulate-dice.cgi?N=7&S=11


      generates a table for seven dice each with 11 sides. You can adjust the 7 and 11 to suit yourself. Related materials, including program source code, are available also.






      share|cite|improve this answer























      • Confirmed by simulation (+1): If you sort the outcomes from 5 dice, you're asking for the longest run length to be at least three. In R, the function rle (for 'run length encoding') does most of the work: three lines of code: set.seed(731); m=10^5; die = 1:6, x=replicate(m,max(rle(sort(sample(die,5,rep=T)))$lengths)), and mean(x >= 3) return 0.21219, which matches your 0.213 within the margin of simulation error.
        – BruceET
        Aug 1 at 5:06











      • Is there a nice way to calculate $n_i$s ?
        – Jaroslaw Matlak
        Aug 1 at 8:42










      • @jaroslaw count the number of occurrences of each letter and store the counts in an array. Then count the occurrences of each value in the array and store those counts in a second array. The second array is $n$.
        – MJD
        Aug 1 at 12:34










      • I see, but is there a simple formula? Because for large $N$ (10,11,12) this array might be very big.
        – Jaroslaw Matlak
        Aug 1 at 12:45






      • 1




        Note that even for large $N$, you do not have to calculate all the patterns and store them. It is not hard to calculate them one at a time, each one from the previous, so that only one is in memory at any time. The Higher-Order Perl link above explains how to do this. Also, for $n=12, d=6$ there are 58 patterns, not 37.
        – MJD
        Aug 1 at 14:05















      up vote
      2
      down vote



      accepted










      In what follows I will refer to “pattern” in the dice rolls. For example the pattern AAABC means that three of the dice show the same number and the other two dice are different from the first three and also different from each other. The roll $1 2 2 4 2$ has this pattern, but $1 2 2 1 2$ does not; that has the pattern AAABB, and similarly $2 2 2 2 1$ is not patternAAABC but AAAAB.



      There are seven patterns possible with five dice:



      AAAAA
      AAAAB
      AAABB
      AAABC

      AABBC
      AABCD
      ABCDE


      If you want three of a kind “or better” on five dice, you are interested in the sum of the first four patterns and you want to disregard the other three. What follows is an explanation of how to compute the probability for each pattern.



      We will represent the patterns numerically like this: AAABC will be $(2, 0, 1)$ because there are two letters that appear once, no letters that appear twice, and one letter that appears three times. AAABB will be $(0, 1, 1)$ because there are no letters that appear once, one that appears twice, and one that appears three times. AABCD is $(3, 1)$ (we omit the trailing zero) and ABCDE is $(5)$. We'll refer to these numbers as $n_1, n_2, ldots$. For AAABC, we have $n_1 = 2, n_2 = 0, n_3 = 1$. For five dice, the representations of the seven patterns are:



      $$beginarraylrrrrr
      & n_1 & n_2 & n_3 & n_4 & n_5 \
      AAAAA & 0 & 0 & 0 & 0 & 1 \
      AAAAB & 1 & 0 & 0 & 1 \
      AAABB & 0 & 1 & 1 \
      AAABC & 2 & 0 & 1 \
      AABBC & 1 & 2 \
      AABCD & 3 & 1 \
      ABCDE & 5
      endarray
      $$



      Now suppose we're rolling $N$ dice each with $d$ sides. If there are $N$ dice, we should always have $sum icdot n_i = N$. We'll also take $k=sum n_i$; this is just the number of different letters in the pattern.



      Then it transpires that the number of ways of rolling any pattern is:



      $$
      colormaroondchoose kcolordarkbluek!
      colordarkgreenN!over colorpurpleprod i!^n_in_i!
      $$



      To get the probability, just divide by $d^N$.



      I'll work through one example to demonstrate the formula. How many ways are there to roll the pattern AAABC, which is three of a kind, but not counting full house, for of a kind, or five of a kind. For AAABC we have $n_1=2, n_2=0, n_3 = 1$, so $k=n_1+n_2+n_3 = 3$, and the formula gives:



      $$colormaroon6choose 3colordarkblue3!
      colordarkgreen5!over colorpurple(1!^2cdot2!)(2!^0cdot0!)(3!^1cdot1!) =
      colormaroon20cdot colordarkblue6cdot
      colordarkgreen120over colorpurple2cdot1cdot6 = mathbf1200
      $$



      There are 1200 ways to roll the pattern AAABC, so the probability is $frac12006^5 approx 15.43%$. Similar calculations for the other three patterns of interest give:



      $$beginarraylrrl
      A A A B C & 1200 & 15.43 & % \
      A A A B B & 300 & 3.86 \
      A A A A B & 150 & 1.93 \
      A A A A A & 6 & 0.08 \ hline
      textTotal & 1656 & 21.30 & %
      endarray
      $$



      So you can expect to get three of a kind or better around one time in five.



      (By far the most common pattern is the single pair AABCD, which occurs almost half the time.)



      I explained the formula in more detail in a blog post. This page tabulates the probabilities for every pattern of up to 12 dice. You program that generated these tables is available online: the URL



       https://perl.plover.com/misc/enumeration/tabulate-dice.cgi?N=7&S=11


      generates a table for seven dice each with 11 sides. You can adjust the 7 and 11 to suit yourself. Related materials, including program source code, are available also.






      share|cite|improve this answer























      • Confirmed by simulation (+1): If you sort the outcomes from 5 dice, you're asking for the longest run length to be at least three. In R, the function rle (for 'run length encoding') does most of the work: three lines of code: set.seed(731); m=10^5; die = 1:6, x=replicate(m,max(rle(sort(sample(die,5,rep=T)))$lengths)), and mean(x >= 3) return 0.21219, which matches your 0.213 within the margin of simulation error.
        – BruceET
        Aug 1 at 5:06











      • Is there a nice way to calculate $n_i$s ?
        – Jaroslaw Matlak
        Aug 1 at 8:42










      • @jaroslaw count the number of occurrences of each letter and store the counts in an array. Then count the occurrences of each value in the array and store those counts in a second array. The second array is $n$.
        – MJD
        Aug 1 at 12:34










      • I see, but is there a simple formula? Because for large $N$ (10,11,12) this array might be very big.
        – Jaroslaw Matlak
        Aug 1 at 12:45






      • 1




        Note that even for large $N$, you do not have to calculate all the patterns and store them. It is not hard to calculate them one at a time, each one from the previous, so that only one is in memory at any time. The Higher-Order Perl link above explains how to do this. Also, for $n=12, d=6$ there are 58 patterns, not 37.
        – MJD
        Aug 1 at 14:05













      up vote
      2
      down vote



      accepted







      up vote
      2
      down vote



      accepted






      In what follows I will refer to “pattern” in the dice rolls. For example the pattern AAABC means that three of the dice show the same number and the other two dice are different from the first three and also different from each other. The roll $1 2 2 4 2$ has this pattern, but $1 2 2 1 2$ does not; that has the pattern AAABB, and similarly $2 2 2 2 1$ is not patternAAABC but AAAAB.



      There are seven patterns possible with five dice:



      AAAAA
      AAAAB
      AAABB
      AAABC

      AABBC
      AABCD
      ABCDE


      If you want three of a kind “or better” on five dice, you are interested in the sum of the first four patterns and you want to disregard the other three. What follows is an explanation of how to compute the probability for each pattern.



      We will represent the patterns numerically like this: AAABC will be $(2, 0, 1)$ because there are two letters that appear once, no letters that appear twice, and one letter that appears three times. AAABB will be $(0, 1, 1)$ because there are no letters that appear once, one that appears twice, and one that appears three times. AABCD is $(3, 1)$ (we omit the trailing zero) and ABCDE is $(5)$. We'll refer to these numbers as $n_1, n_2, ldots$. For AAABC, we have $n_1 = 2, n_2 = 0, n_3 = 1$. For five dice, the representations of the seven patterns are:



      $$beginarraylrrrrr
      & n_1 & n_2 & n_3 & n_4 & n_5 \
      AAAAA & 0 & 0 & 0 & 0 & 1 \
      AAAAB & 1 & 0 & 0 & 1 \
      AAABB & 0 & 1 & 1 \
      AAABC & 2 & 0 & 1 \
      AABBC & 1 & 2 \
      AABCD & 3 & 1 \
      ABCDE & 5
      endarray
      $$



      Now suppose we're rolling $N$ dice each with $d$ sides. If there are $N$ dice, we should always have $sum icdot n_i = N$. We'll also take $k=sum n_i$; this is just the number of different letters in the pattern.



      Then it transpires that the number of ways of rolling any pattern is:



      $$
      colormaroondchoose kcolordarkbluek!
      colordarkgreenN!over colorpurpleprod i!^n_in_i!
      $$



      To get the probability, just divide by $d^N$.



      I'll work through one example to demonstrate the formula. How many ways are there to roll the pattern AAABC, which is three of a kind, but not counting full house, for of a kind, or five of a kind. For AAABC we have $n_1=2, n_2=0, n_3 = 1$, so $k=n_1+n_2+n_3 = 3$, and the formula gives:



      $$colormaroon6choose 3colordarkblue3!
      colordarkgreen5!over colorpurple(1!^2cdot2!)(2!^0cdot0!)(3!^1cdot1!) =
      colormaroon20cdot colordarkblue6cdot
      colordarkgreen120over colorpurple2cdot1cdot6 = mathbf1200
      $$



      There are 1200 ways to roll the pattern AAABC, so the probability is $frac12006^5 approx 15.43%$. Similar calculations for the other three patterns of interest give:



      $$beginarraylrrl
      A A A B C & 1200 & 15.43 & % \
      A A A B B & 300 & 3.86 \
      A A A A B & 150 & 1.93 \
      A A A A A & 6 & 0.08 \ hline
      textTotal & 1656 & 21.30 & %
      endarray
      $$



      So you can expect to get three of a kind or better around one time in five.



      (By far the most common pattern is the single pair AABCD, which occurs almost half the time.)



      I explained the formula in more detail in a blog post. This page tabulates the probabilities for every pattern of up to 12 dice. You program that generated these tables is available online: the URL



       https://perl.plover.com/misc/enumeration/tabulate-dice.cgi?N=7&S=11


      generates a table for seven dice each with 11 sides. You can adjust the 7 and 11 to suit yourself. Related materials, including program source code, are available also.






      share|cite|improve this answer















      In what follows I will refer to “pattern” in the dice rolls. For example the pattern AAABC means that three of the dice show the same number and the other two dice are different from the first three and also different from each other. The roll $1 2 2 4 2$ has this pattern, but $1 2 2 1 2$ does not; that has the pattern AAABB, and similarly $2 2 2 2 1$ is not patternAAABC but AAAAB.



      There are seven patterns possible with five dice:



      AAAAA
      AAAAB
      AAABB
      AAABC

      AABBC
      AABCD
      ABCDE


      If you want three of a kind “or better” on five dice, you are interested in the sum of the first four patterns and you want to disregard the other three. What follows is an explanation of how to compute the probability for each pattern.



      We will represent the patterns numerically like this: AAABC will be $(2, 0, 1)$ because there are two letters that appear once, no letters that appear twice, and one letter that appears three times. AAABB will be $(0, 1, 1)$ because there are no letters that appear once, one that appears twice, and one that appears three times. AABCD is $(3, 1)$ (we omit the trailing zero) and ABCDE is $(5)$. We'll refer to these numbers as $n_1, n_2, ldots$. For AAABC, we have $n_1 = 2, n_2 = 0, n_3 = 1$. For five dice, the representations of the seven patterns are:



      $$beginarraylrrrrr
      & n_1 & n_2 & n_3 & n_4 & n_5 \
      AAAAA & 0 & 0 & 0 & 0 & 1 \
      AAAAB & 1 & 0 & 0 & 1 \
      AAABB & 0 & 1 & 1 \
      AAABC & 2 & 0 & 1 \
      AABBC & 1 & 2 \
      AABCD & 3 & 1 \
      ABCDE & 5
      endarray
      $$



      Now suppose we're rolling $N$ dice each with $d$ sides. If there are $N$ dice, we should always have $sum icdot n_i = N$. We'll also take $k=sum n_i$; this is just the number of different letters in the pattern.



      Then it transpires that the number of ways of rolling any pattern is:



      $$
      colormaroondchoose kcolordarkbluek!
      colordarkgreenN!over colorpurpleprod i!^n_in_i!
      $$



      To get the probability, just divide by $d^N$.



      I'll work through one example to demonstrate the formula. How many ways are there to roll the pattern AAABC, which is three of a kind, but not counting full house, for of a kind, or five of a kind. For AAABC we have $n_1=2, n_2=0, n_3 = 1$, so $k=n_1+n_2+n_3 = 3$, and the formula gives:



      $$colormaroon6choose 3colordarkblue3!
      colordarkgreen5!over colorpurple(1!^2cdot2!)(2!^0cdot0!)(3!^1cdot1!) =
      colormaroon20cdot colordarkblue6cdot
      colordarkgreen120over colorpurple2cdot1cdot6 = mathbf1200
      $$



      There are 1200 ways to roll the pattern AAABC, so the probability is $frac12006^5 approx 15.43%$. Similar calculations for the other three patterns of interest give:



      $$beginarraylrrl
      A A A B C & 1200 & 15.43 & % \
      A A A B B & 300 & 3.86 \
      A A A A B & 150 & 1.93 \
      A A A A A & 6 & 0.08 \ hline
      textTotal & 1656 & 21.30 & %
      endarray
      $$



      So you can expect to get three of a kind or better around one time in five.



      (By far the most common pattern is the single pair AABCD, which occurs almost half the time.)



      I explained the formula in more detail in a blog post. This page tabulates the probabilities for every pattern of up to 12 dice. You program that generated these tables is available online: the URL



       https://perl.plover.com/misc/enumeration/tabulate-dice.cgi?N=7&S=11


      generates a table for seven dice each with 11 sides. You can adjust the 7 and 11 to suit yourself. Related materials, including program source code, are available also.







      share|cite|improve this answer















      share|cite|improve this answer



      share|cite|improve this answer








      edited Aug 1 at 5:33



























      community wiki





      3 revs
      MJD












      • Confirmed by simulation (+1): If you sort the outcomes from 5 dice, you're asking for the longest run length to be at least three. In R, the function rle (for 'run length encoding') does most of the work: three lines of code: set.seed(731); m=10^5; die = 1:6, x=replicate(m,max(rle(sort(sample(die,5,rep=T)))$lengths)), and mean(x >= 3) return 0.21219, which matches your 0.213 within the margin of simulation error.
        – BruceET
        Aug 1 at 5:06











      • Is there a nice way to calculate $n_i$s ?
        – Jaroslaw Matlak
        Aug 1 at 8:42










      • @jaroslaw count the number of occurrences of each letter and store the counts in an array. Then count the occurrences of each value in the array and store those counts in a second array. The second array is $n$.
        – MJD
        Aug 1 at 12:34










      • I see, but is there a simple formula? Because for large $N$ (10,11,12) this array might be very big.
        – Jaroslaw Matlak
        Aug 1 at 12:45






      • 1




        Note that even for large $N$, you do not have to calculate all the patterns and store them. It is not hard to calculate them one at a time, each one from the previous, so that only one is in memory at any time. The Higher-Order Perl link above explains how to do this. Also, for $n=12, d=6$ there are 58 patterns, not 37.
        – MJD
        Aug 1 at 14:05

















      • Confirmed by simulation (+1): If you sort the outcomes from 5 dice, you're asking for the longest run length to be at least three. In R, the function rle (for 'run length encoding') does most of the work: three lines of code: set.seed(731); m=10^5; die = 1:6, x=replicate(m,max(rle(sort(sample(die,5,rep=T)))$lengths)), and mean(x >= 3) return 0.21219, which matches your 0.213 within the margin of simulation error.
        – BruceET
        Aug 1 at 5:06











      • Is there a nice way to calculate $n_i$s ?
        – Jaroslaw Matlak
        Aug 1 at 8:42










      • @jaroslaw count the number of occurrences of each letter and store the counts in an array. Then count the occurrences of each value in the array and store those counts in a second array. The second array is $n$.
        – MJD
        Aug 1 at 12:34










      • I see, but is there a simple formula? Because for large $N$ (10,11,12) this array might be very big.
        – Jaroslaw Matlak
        Aug 1 at 12:45






      • 1




        Note that even for large $N$, you do not have to calculate all the patterns and store them. It is not hard to calculate them one at a time, each one from the previous, so that only one is in memory at any time. The Higher-Order Perl link above explains how to do this. Also, for $n=12, d=6$ there are 58 patterns, not 37.
        – MJD
        Aug 1 at 14:05
















      Confirmed by simulation (+1): If you sort the outcomes from 5 dice, you're asking for the longest run length to be at least three. In R, the function rle (for 'run length encoding') does most of the work: three lines of code: set.seed(731); m=10^5; die = 1:6, x=replicate(m,max(rle(sort(sample(die,5,rep=T)))$lengths)), and mean(x >= 3) return 0.21219, which matches your 0.213 within the margin of simulation error.
      – BruceET
      Aug 1 at 5:06





      Confirmed by simulation (+1): If you sort the outcomes from 5 dice, you're asking for the longest run length to be at least three. In R, the function rle (for 'run length encoding') does most of the work: three lines of code: set.seed(731); m=10^5; die = 1:6, x=replicate(m,max(rle(sort(sample(die,5,rep=T)))$lengths)), and mean(x >= 3) return 0.21219, which matches your 0.213 within the margin of simulation error.
      – BruceET
      Aug 1 at 5:06













      Is there a nice way to calculate $n_i$s ?
      – Jaroslaw Matlak
      Aug 1 at 8:42




      Is there a nice way to calculate $n_i$s ?
      – Jaroslaw Matlak
      Aug 1 at 8:42












      @jaroslaw count the number of occurrences of each letter and store the counts in an array. Then count the occurrences of each value in the array and store those counts in a second array. The second array is $n$.
      – MJD
      Aug 1 at 12:34




      @jaroslaw count the number of occurrences of each letter and store the counts in an array. Then count the occurrences of each value in the array and store those counts in a second array. The second array is $n$.
      – MJD
      Aug 1 at 12:34












      I see, but is there a simple formula? Because for large $N$ (10,11,12) this array might be very big.
      – Jaroslaw Matlak
      Aug 1 at 12:45




      I see, but is there a simple formula? Because for large $N$ (10,11,12) this array might be very big.
      – Jaroslaw Matlak
      Aug 1 at 12:45




      1




      1




      Note that even for large $N$, you do not have to calculate all the patterns and store them. It is not hard to calculate them one at a time, each one from the previous, so that only one is in memory at any time. The Higher-Order Perl link above explains how to do this. Also, for $n=12, d=6$ there are 58 patterns, not 37.
      – MJD
      Aug 1 at 14:05





      Note that even for large $N$, you do not have to calculate all the patterns and store them. It is not hard to calculate them one at a time, each one from the previous, so that only one is in memory at any time. The Higher-Order Perl link above explains how to do this. Also, for $n=12, d=6$ there are 58 patterns, not 37.
      – MJD
      Aug 1 at 14:05











      up vote
      0
      down vote













      If I understand your problem correctly, you're looking for a generalization of the binomial distribution to $n > 2$ where $n$ is the number of possible classes. The term for this is a multinomial distribution.



      We can view a $n = 2$ side analog of a dice as a coin. The probability of a single outcome is a Bernoulli distribution (e.g. $Pr(H)$). The probability of multiple outcomes is a Binomial distribution (e.g. $Pr(HT)$).



      For $n > 2$, the probability of a single outcome is a Categorical distribution (e.g. $Pr(1)$). The probability of multiple outcomes is a Multinomial distribution (e.g. $Pr(1126)$).



      Remember that a multinomial distribution will only tell you the distribution of, say 5 of the rolls being $1$. So if you're looking for pairs or triplets regardless of the class -- whether its 1 or 2, you don't care -- you have to multiply your probability (if its a fair dice) or construct a sum in the case the dice is not fair.






      share|cite|improve this answer

























        up vote
        0
        down vote













        If I understand your problem correctly, you're looking for a generalization of the binomial distribution to $n > 2$ where $n$ is the number of possible classes. The term for this is a multinomial distribution.



        We can view a $n = 2$ side analog of a dice as a coin. The probability of a single outcome is a Bernoulli distribution (e.g. $Pr(H)$). The probability of multiple outcomes is a Binomial distribution (e.g. $Pr(HT)$).



        For $n > 2$, the probability of a single outcome is a Categorical distribution (e.g. $Pr(1)$). The probability of multiple outcomes is a Multinomial distribution (e.g. $Pr(1126)$).



        Remember that a multinomial distribution will only tell you the distribution of, say 5 of the rolls being $1$. So if you're looking for pairs or triplets regardless of the class -- whether its 1 or 2, you don't care -- you have to multiply your probability (if its a fair dice) or construct a sum in the case the dice is not fair.






        share|cite|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          If I understand your problem correctly, you're looking for a generalization of the binomial distribution to $n > 2$ where $n$ is the number of possible classes. The term for this is a multinomial distribution.



          We can view a $n = 2$ side analog of a dice as a coin. The probability of a single outcome is a Bernoulli distribution (e.g. $Pr(H)$). The probability of multiple outcomes is a Binomial distribution (e.g. $Pr(HT)$).



          For $n > 2$, the probability of a single outcome is a Categorical distribution (e.g. $Pr(1)$). The probability of multiple outcomes is a Multinomial distribution (e.g. $Pr(1126)$).



          Remember that a multinomial distribution will only tell you the distribution of, say 5 of the rolls being $1$. So if you're looking for pairs or triplets regardless of the class -- whether its 1 or 2, you don't care -- you have to multiply your probability (if its a fair dice) or construct a sum in the case the dice is not fair.






          share|cite|improve this answer













          If I understand your problem correctly, you're looking for a generalization of the binomial distribution to $n > 2$ where $n$ is the number of possible classes. The term for this is a multinomial distribution.



          We can view a $n = 2$ side analog of a dice as a coin. The probability of a single outcome is a Bernoulli distribution (e.g. $Pr(H)$). The probability of multiple outcomes is a Binomial distribution (e.g. $Pr(HT)$).



          For $n > 2$, the probability of a single outcome is a Categorical distribution (e.g. $Pr(1)$). The probability of multiple outcomes is a Multinomial distribution (e.g. $Pr(1126)$).



          Remember that a multinomial distribution will only tell you the distribution of, say 5 of the rolls being $1$. So if you're looking for pairs or triplets regardless of the class -- whether its 1 or 2, you don't care -- you have to multiply your probability (if its a fair dice) or construct a sum in the case the dice is not fair.







          share|cite|improve this answer













          share|cite|improve this answer



          share|cite|improve this answer











          answered Aug 1 at 2:36









          Sentient

          439516




          439516




















              up vote
              0
              down vote













              Hint



              You can compute the probability of not getting triple. The number $f_n$ of possibilities of not getting triples in $n$ throws is:
              $$f_1 = binom61\
              f_2 = binom622!+binom61\
              f_3=binom633!+binom61binom51frac3!2!\
              f_4=binom644!+binom61binom52frac4!2!+binom62frac4!2!2!\
              f_5=binom655!+binom61binom53frac5!2!+binom62binom41frac5!2!2!\
              f_6=binom666!+binom61binom54frac6!2!+binom62binom42frac6!2!2!+binom63frac6!2!2!2!\
              f_7=binom61frac7!2!+binom62binom43frac7!2!2!+binom63binom31frac7!2!2!2!\
              f_8=binom62frac8!2!2!+binom63binom32frac8!2!2!2!+binom64frac8!2!2!2!2!\
              f_9=binom63frac9!2!2!2!+binom64binom21frac9!2!2!2!2!\
              f_10 = binom64frac10!2!2!2!2!+binom65frac10!2!2!2!2!2!\
              f_11=binom65frac11!2!2!2!2!2!\
              f_12=binom66frac12!2!2!2!2!2!2!$$
              For $k>13$ we have $f_k=0$



              The number of all possible throws $omega_n$ is:
              $$omega_n=6^n$$
              Now you can compute the probability of not getting triple:
              $$p_n=fracf_nomega_n$$
              and probability of getting triple:
              $$q_n=1-p_n$$






              share|cite|improve this answer























              • Thanks a lot for the suggestion. It does allow to solve the "triples" problem but not the "or better" part. Still pretty interesting take on the problem.
                – user1747281
                Jul 31 at 16:41










              • Actually this solution consider "or better" as a triple. $p_n$ denotes the number of events, where there at most pairs.
                – Jaroslaw Matlak
                Jul 31 at 21:36










              • What am I getting wrong? If $n=5,$ then $f_5 = 6+60+60=126$ and $omega_n = 252,$ so $q_n = p_n = .5.$ Which is already larger than @MJD's answer. (Seems exactly a triple has probability $approx 0.19.)$
                – BruceET
                Aug 1 at 5:24







              • 1




                @BruceET You're right - my answer was not complete (I comsidered each situation as one, while there are more possibilities of throwing AAABB for given A and B than AAAAA. I've edited my answer.
                – Jaroslaw Matlak
                Aug 1 at 8:37














              up vote
              0
              down vote













              Hint



              You can compute the probability of not getting triple. The number $f_n$ of possibilities of not getting triples in $n$ throws is:
              $$f_1 = binom61\
              f_2 = binom622!+binom61\
              f_3=binom633!+binom61binom51frac3!2!\
              f_4=binom644!+binom61binom52frac4!2!+binom62frac4!2!2!\
              f_5=binom655!+binom61binom53frac5!2!+binom62binom41frac5!2!2!\
              f_6=binom666!+binom61binom54frac6!2!+binom62binom42frac6!2!2!+binom63frac6!2!2!2!\
              f_7=binom61frac7!2!+binom62binom43frac7!2!2!+binom63binom31frac7!2!2!2!\
              f_8=binom62frac8!2!2!+binom63binom32frac8!2!2!2!+binom64frac8!2!2!2!2!\
              f_9=binom63frac9!2!2!2!+binom64binom21frac9!2!2!2!2!\
              f_10 = binom64frac10!2!2!2!2!+binom65frac10!2!2!2!2!2!\
              f_11=binom65frac11!2!2!2!2!2!\
              f_12=binom66frac12!2!2!2!2!2!2!$$
              For $k>13$ we have $f_k=0$



              The number of all possible throws $omega_n$ is:
              $$omega_n=6^n$$
              Now you can compute the probability of not getting triple:
              $$p_n=fracf_nomega_n$$
              and probability of getting triple:
              $$q_n=1-p_n$$






              share|cite|improve this answer























              • Thanks a lot for the suggestion. It does allow to solve the "triples" problem but not the "or better" part. Still pretty interesting take on the problem.
                – user1747281
                Jul 31 at 16:41










              • Actually this solution consider "or better" as a triple. $p_n$ denotes the number of events, where there at most pairs.
                – Jaroslaw Matlak
                Jul 31 at 21:36










              • What am I getting wrong? If $n=5,$ then $f_5 = 6+60+60=126$ and $omega_n = 252,$ so $q_n = p_n = .5.$ Which is already larger than @MJD's answer. (Seems exactly a triple has probability $approx 0.19.)$
                – BruceET
                Aug 1 at 5:24







              • 1




                @BruceET You're right - my answer was not complete (I comsidered each situation as one, while there are more possibilities of throwing AAABB for given A and B than AAAAA. I've edited my answer.
                – Jaroslaw Matlak
                Aug 1 at 8:37












              up vote
              0
              down vote










              up vote
              0
              down vote









              Hint



              You can compute the probability of not getting triple. The number $f_n$ of possibilities of not getting triples in $n$ throws is:
              $$f_1 = binom61\
              f_2 = binom622!+binom61\
              f_3=binom633!+binom61binom51frac3!2!\
              f_4=binom644!+binom61binom52frac4!2!+binom62frac4!2!2!\
              f_5=binom655!+binom61binom53frac5!2!+binom62binom41frac5!2!2!\
              f_6=binom666!+binom61binom54frac6!2!+binom62binom42frac6!2!2!+binom63frac6!2!2!2!\
              f_7=binom61frac7!2!+binom62binom43frac7!2!2!+binom63binom31frac7!2!2!2!\
              f_8=binom62frac8!2!2!+binom63binom32frac8!2!2!2!+binom64frac8!2!2!2!2!\
              f_9=binom63frac9!2!2!2!+binom64binom21frac9!2!2!2!2!\
              f_10 = binom64frac10!2!2!2!2!+binom65frac10!2!2!2!2!2!\
              f_11=binom65frac11!2!2!2!2!2!\
              f_12=binom66frac12!2!2!2!2!2!2!$$
              For $k>13$ we have $f_k=0$



              The number of all possible throws $omega_n$ is:
              $$omega_n=6^n$$
              Now you can compute the probability of not getting triple:
              $$p_n=fracf_nomega_n$$
              and probability of getting triple:
              $$q_n=1-p_n$$






              share|cite|improve this answer















              Hint



              You can compute the probability of not getting triple. The number $f_n$ of possibilities of not getting triples in $n$ throws is:
              $$f_1 = binom61\
              f_2 = binom622!+binom61\
              f_3=binom633!+binom61binom51frac3!2!\
              f_4=binom644!+binom61binom52frac4!2!+binom62frac4!2!2!\
              f_5=binom655!+binom61binom53frac5!2!+binom62binom41frac5!2!2!\
              f_6=binom666!+binom61binom54frac6!2!+binom62binom42frac6!2!2!+binom63frac6!2!2!2!\
              f_7=binom61frac7!2!+binom62binom43frac7!2!2!+binom63binom31frac7!2!2!2!\
              f_8=binom62frac8!2!2!+binom63binom32frac8!2!2!2!+binom64frac8!2!2!2!2!\
              f_9=binom63frac9!2!2!2!+binom64binom21frac9!2!2!2!2!\
              f_10 = binom64frac10!2!2!2!2!+binom65frac10!2!2!2!2!2!\
              f_11=binom65frac11!2!2!2!2!2!\
              f_12=binom66frac12!2!2!2!2!2!2!$$
              For $k>13$ we have $f_k=0$



              The number of all possible throws $omega_n$ is:
              $$omega_n=6^n$$
              Now you can compute the probability of not getting triple:
              $$p_n=fracf_nomega_n$$
              and probability of getting triple:
              $$q_n=1-p_n$$







              share|cite|improve this answer















              share|cite|improve this answer



              share|cite|improve this answer








              edited Aug 1 at 8:33


























              answered Jul 31 at 14:39









              Jaroslaw Matlak

              3,870830




              3,870830











              • Thanks a lot for the suggestion. It does allow to solve the "triples" problem but not the "or better" part. Still pretty interesting take on the problem.
                – user1747281
                Jul 31 at 16:41










              • Actually this solution consider "or better" as a triple. $p_n$ denotes the number of events, where there at most pairs.
                – Jaroslaw Matlak
                Jul 31 at 21:36










              • What am I getting wrong? If $n=5,$ then $f_5 = 6+60+60=126$ and $omega_n = 252,$ so $q_n = p_n = .5.$ Which is already larger than @MJD's answer. (Seems exactly a triple has probability $approx 0.19.)$
                – BruceET
                Aug 1 at 5:24







              • 1




                @BruceET You're right - my answer was not complete (I comsidered each situation as one, while there are more possibilities of throwing AAABB for given A and B than AAAAA. I've edited my answer.
                – Jaroslaw Matlak
                Aug 1 at 8:37
















              • Thanks a lot for the suggestion. It does allow to solve the "triples" problem but not the "or better" part. Still pretty interesting take on the problem.
                – user1747281
                Jul 31 at 16:41










              • Actually this solution consider "or better" as a triple. $p_n$ denotes the number of events, where there at most pairs.
                – Jaroslaw Matlak
                Jul 31 at 21:36










              • What am I getting wrong? If $n=5,$ then $f_5 = 6+60+60=126$ and $omega_n = 252,$ so $q_n = p_n = .5.$ Which is already larger than @MJD's answer. (Seems exactly a triple has probability $approx 0.19.)$
                – BruceET
                Aug 1 at 5:24







              • 1




                @BruceET You're right - my answer was not complete (I comsidered each situation as one, while there are more possibilities of throwing AAABB for given A and B than AAAAA. I've edited my answer.
                – Jaroslaw Matlak
                Aug 1 at 8:37















              Thanks a lot for the suggestion. It does allow to solve the "triples" problem but not the "or better" part. Still pretty interesting take on the problem.
              – user1747281
              Jul 31 at 16:41




              Thanks a lot for the suggestion. It does allow to solve the "triples" problem but not the "or better" part. Still pretty interesting take on the problem.
              – user1747281
              Jul 31 at 16:41












              Actually this solution consider "or better" as a triple. $p_n$ denotes the number of events, where there at most pairs.
              – Jaroslaw Matlak
              Jul 31 at 21:36




              Actually this solution consider "or better" as a triple. $p_n$ denotes the number of events, where there at most pairs.
              – Jaroslaw Matlak
              Jul 31 at 21:36












              What am I getting wrong? If $n=5,$ then $f_5 = 6+60+60=126$ and $omega_n = 252,$ so $q_n = p_n = .5.$ Which is already larger than @MJD's answer. (Seems exactly a triple has probability $approx 0.19.)$
              – BruceET
              Aug 1 at 5:24





              What am I getting wrong? If $n=5,$ then $f_5 = 6+60+60=126$ and $omega_n = 252,$ so $q_n = p_n = .5.$ Which is already larger than @MJD's answer. (Seems exactly a triple has probability $approx 0.19.)$
              – BruceET
              Aug 1 at 5:24





              1




              1




              @BruceET You're right - my answer was not complete (I comsidered each situation as one, while there are more possibilities of throwing AAABB for given A and B than AAAAA. I've edited my answer.
              – Jaroslaw Matlak
              Aug 1 at 8:37




              @BruceET You're right - my answer was not complete (I comsidered each situation as one, while there are more possibilities of throwing AAABB for given A and B than AAAAA. I've edited my answer.
              – Jaroslaw Matlak
              Aug 1 at 8:37










              up vote
              0
              down vote













              The OP is correct in saying that this is a generalization of the Birthday Problem and that it is harder because we are interested in cases where the number of people with the same birthday is greater than two. One approach is by way of exponential generating functions.



              Let's take a concrete example. Suppose we want to roll $10$ six-sided dice and find the probability that at least one number comes up $5$ or more times. It seems easier to consider the complementary event, i.e. all numbers come up $4$ or fewer times. There are $6^10$ possible sequences of die rolls, all of which we assume are equally likely. We would like to count the number of sequences in which no number comes up more than $4$ times. We generalize the problem a bit and think about a sequence of $n$ die rolls, and let the number of sequences in which no number appears more than $4$ times be $a_n$.



              The exponential generating function of $a_n$ is defined to be
              $$f(x) = sum_n=0^infty frac1n! a_n x^n$$
              Since each die has $6$ sides and each number appears no more than $4$ times,
              $$f(x) = left( sum_i=0^4 frac1i! x^i right)^6$$
              The number we want in our problem, $a_10$, is $10!$ times the coefficient of $x^10$ when $f(x)$ is expanded. I suppose a pencil and paper solution is possible, but I took the easy way out and used a computer algebra system to find that the coefficient of $x^10$ is $2177 / 144$. Therefore the number of sequences of $10$ die rolls in which no number appears more than $4$ times is $$a_10 = 10! times frac2177 144 = 54,860,400$$



              So the probability that no number appears more than $4$ times in $10$ rolls is
              $$p = fraca_106^10 = 0.907291$$
              and the probability that at least one number appears $5$ times or more is
              $$1-p = 0.0927093$$






              share|cite|improve this answer

























                up vote
                0
                down vote













                The OP is correct in saying that this is a generalization of the Birthday Problem and that it is harder because we are interested in cases where the number of people with the same birthday is greater than two. One approach is by way of exponential generating functions.



                Let's take a concrete example. Suppose we want to roll $10$ six-sided dice and find the probability that at least one number comes up $5$ or more times. It seems easier to consider the complementary event, i.e. all numbers come up $4$ or fewer times. There are $6^10$ possible sequences of die rolls, all of which we assume are equally likely. We would like to count the number of sequences in which no number comes up more than $4$ times. We generalize the problem a bit and think about a sequence of $n$ die rolls, and let the number of sequences in which no number appears more than $4$ times be $a_n$.



                The exponential generating function of $a_n$ is defined to be
                $$f(x) = sum_n=0^infty frac1n! a_n x^n$$
                Since each die has $6$ sides and each number appears no more than $4$ times,
                $$f(x) = left( sum_i=0^4 frac1i! x^i right)^6$$
                The number we want in our problem, $a_10$, is $10!$ times the coefficient of $x^10$ when $f(x)$ is expanded. I suppose a pencil and paper solution is possible, but I took the easy way out and used a computer algebra system to find that the coefficient of $x^10$ is $2177 / 144$. Therefore the number of sequences of $10$ die rolls in which no number appears more than $4$ times is $$a_10 = 10! times frac2177 144 = 54,860,400$$



                So the probability that no number appears more than $4$ times in $10$ rolls is
                $$p = fraca_106^10 = 0.907291$$
                and the probability that at least one number appears $5$ times or more is
                $$1-p = 0.0927093$$






                share|cite|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  The OP is correct in saying that this is a generalization of the Birthday Problem and that it is harder because we are interested in cases where the number of people with the same birthday is greater than two. One approach is by way of exponential generating functions.



                  Let's take a concrete example. Suppose we want to roll $10$ six-sided dice and find the probability that at least one number comes up $5$ or more times. It seems easier to consider the complementary event, i.e. all numbers come up $4$ or fewer times. There are $6^10$ possible sequences of die rolls, all of which we assume are equally likely. We would like to count the number of sequences in which no number comes up more than $4$ times. We generalize the problem a bit and think about a sequence of $n$ die rolls, and let the number of sequences in which no number appears more than $4$ times be $a_n$.



                  The exponential generating function of $a_n$ is defined to be
                  $$f(x) = sum_n=0^infty frac1n! a_n x^n$$
                  Since each die has $6$ sides and each number appears no more than $4$ times,
                  $$f(x) = left( sum_i=0^4 frac1i! x^i right)^6$$
                  The number we want in our problem, $a_10$, is $10!$ times the coefficient of $x^10$ when $f(x)$ is expanded. I suppose a pencil and paper solution is possible, but I took the easy way out and used a computer algebra system to find that the coefficient of $x^10$ is $2177 / 144$. Therefore the number of sequences of $10$ die rolls in which no number appears more than $4$ times is $$a_10 = 10! times frac2177 144 = 54,860,400$$



                  So the probability that no number appears more than $4$ times in $10$ rolls is
                  $$p = fraca_106^10 = 0.907291$$
                  and the probability that at least one number appears $5$ times or more is
                  $$1-p = 0.0927093$$






                  share|cite|improve this answer













                  The OP is correct in saying that this is a generalization of the Birthday Problem and that it is harder because we are interested in cases where the number of people with the same birthday is greater than two. One approach is by way of exponential generating functions.



                  Let's take a concrete example. Suppose we want to roll $10$ six-sided dice and find the probability that at least one number comes up $5$ or more times. It seems easier to consider the complementary event, i.e. all numbers come up $4$ or fewer times. There are $6^10$ possible sequences of die rolls, all of which we assume are equally likely. We would like to count the number of sequences in which no number comes up more than $4$ times. We generalize the problem a bit and think about a sequence of $n$ die rolls, and let the number of sequences in which no number appears more than $4$ times be $a_n$.



                  The exponential generating function of $a_n$ is defined to be
                  $$f(x) = sum_n=0^infty frac1n! a_n x^n$$
                  Since each die has $6$ sides and each number appears no more than $4$ times,
                  $$f(x) = left( sum_i=0^4 frac1i! x^i right)^6$$
                  The number we want in our problem, $a_10$, is $10!$ times the coefficient of $x^10$ when $f(x)$ is expanded. I suppose a pencil and paper solution is possible, but I took the easy way out and used a computer algebra system to find that the coefficient of $x^10$ is $2177 / 144$. Therefore the number of sequences of $10$ die rolls in which no number appears more than $4$ times is $$a_10 = 10! times frac2177 144 = 54,860,400$$



                  So the probability that no number appears more than $4$ times in $10$ rolls is
                  $$p = fraca_106^10 = 0.907291$$
                  and the probability that at least one number appears $5$ times or more is
                  $$1-p = 0.0927093$$







                  share|cite|improve this answer













                  share|cite|improve this answer



                  share|cite|improve this answer











                  answered Aug 1 at 18:00









                  awkward

                  5,05611021




                  5,05611021






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2868036%2fhow-can-i-calculate-the-probability-to-get-triples-or-better-when-throwing-n-6-s%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      Relationship between determinant of matrix and determinant of adjoint?

                      Color the edges and diagonals of a regular polygon

                      What is the equation of a 3D cone with generalised tilt?