### Dice, Probabilities and Go, part 1.5

Well, I had planned to write up a full second post right now about switching from using the recursive formula for calculating the probability of rolling some number from multiple dice to using binomial coefficients to avoid floating point math until the last step. However, Daniel Martin pointed out that with a very small change, I could push off the floating point calc to the very end. Also, if you define N(s, n, k) == s^n * F(s,n,k), you get a nicer recursion relation: (in pseudo-python) N(s, 1, k) == 1 if 1 <= k <= s else 0 N(s, n, k) == sum(N(s, n-1, k-i) for i in [1..s]) Can't argue with that logic. This is why code reviews are great! So I spent a little time getting that working and fast. Switching to integer math made it correct and adding memoization made it much faster. package main import ( "fmt" "math" ) func main() { printRolls_secondTry(6, 6) } func dieRolls_secondTryWithCache(sides, rolls, dieSum int,