Rolling 5, 6 sided dice where top 3 equal 15. How many rolls? How in Recursion?

239 Views Asked by At

Let's say that I have 5 (n), 6-sided (d) normal dice. How would I figure out how many possible rolls there are, where the top 3 (k) numbers rolled, equal 15 (t)? How would I do this using recursion such as $$f(n,d,k,t) = \sum\limits_{i=1}^j f(something, with, n,d,k,t...)$$ where the base cases are something else. How would I figure this out? Please help. Thank you. $\ddot\smile$

1

There are 1 best solutions below

0
On

Going off of my comment, if we add a parameter $p$ being the top die not in the current top $k$ (and discard the $d$, because all the dice are 6-sided anyways), then I believe we get to the following: $$ f(n, p, k, t) = \sum_{p'=1}^6\sum_{i=1}^{6}\frac{1}{36}\cdot f\left(n-1,p', k-1, t-(\max(p', i))\right) $$ The variable $i$ represents the result of next die being thrown.

I do not know if this is correct. I was just facinated with the question and wanted to have a go at it. This is what I came up with.

The final probability of sum $15$ would then be $$ \sum_{p=1}^6 f(5, p, 3, 15) $$ with recursion base cases at $n=3, k=1$.

The general idea behind coming up with recursions like this is the following: You want to know the probability of reaching a state $A$. Then you look at all cases from which $A$ is immedately reachable and multiply the probability of reaching those states with the probability of reaching $A$ from that 'pre-state'. Then you sum this up over all pre-states.