2

If you roll $n$ six-sided dice what is the probability that the sum of the numbers you roll is multiple of $k?$

I was wondering which combinatoric strategies would be useful to solve problems of these types. I often just find the probability for each multiple of $k$ and sum them up. Is there a more efficient way to approach this question?

BruceET
  • 51,500
Anirudh
  • 714
  • That sounds as good a plan as any without more context or clarifications. Your problem statement however could use a lot of work... Are you rolling one $n$-sided die? Or are you rolling $n$ six-sided dice? If multiple dice, are you adding the results together or are you asking if there is at least one multiple of $k$ in the lot? – JMoravitz Aug 12 '17 at 22:02
  • what exactly means "roll a number that is a multiple of $k$"? It means that the sum of the sides of the dice is a multiple of $k$? It means that there are some side repeated a multiple of $k$? Etc... – Masacroso Aug 12 '17 at 22:02
  • Sorry about that just fixed up the problem statement a bit now – Anirudh Aug 12 '17 at 22:05
  • I dont know a better way than use the formula that I wrote some time ago in this answer. You can write it as a sum of coefficients, if you like, but to evaluate these quantities efficiently probably the best way to do it is write some kind of recursion and run it in a program. In this case you can follow the steps to write a recursion using the $xD\log$ procedure described in page 22 of the free book generatingfunctionology of Wilf using the generating function $f$ described in the linked answer. – Masacroso Aug 12 '17 at 22:28

1 Answers1

5

Let $$ \begin{align} f(x) &=x+x^2+x^3+x^4+x^5+x^6\\ &=\frac{x-x^7}{1-x}\tag{1} \end{align} $$ then $f(x)^n$ is the generating function of the number of ways to roll a given number on $n$ dice.

Thus, since $$ \frac1k\sum_{j=0}^{k-1}e^{2\pi i\,jm/k}=[k\mid m]\tag{2} $$ where $[\dots]$ are Iverson Brackets, the probability of rolling $m\pmod{k}$ on $n$ dice is $$ \frac1{k6^n}\sum_{j=0}^{k-1}e^{-2\pi i\,jm/k}f\!\left(e^{2\pi i\,j/k}\right)^n\tag{3} $$ For this question, we can set $m=0$ in $(3)$.

robjohn
  • 345,667
  • 1
    For $k = 6$ it's easy to check that the $j = 0$ summand is $6^n$ while the $j = 1, 2, 3, 4, 5$ summands are 0. So you get that the probability of rolling a multiple of 6 is $1/6$. There's an easy proof of this without using generating functions: no matter what you roll on the first $n - 1$ dice, there is exactly one choice of roll on the $n$th die that will give you a multiple of 6. Similarly the probability of getting a total which is a multiple of 2 or 3 is $1/2$ or $1/3$ respectively. – Michael Lugo Aug 13 '17 at 00:54
  • 1
    Just wondering what is the computational complexity of this method? – Anirudh Aug 13 '17 at 06:12
  • @Anirudh: It depends on what you are counting. The number of exponentials computed is $3k$. – robjohn Aug 13 '17 at 07:47