Hey /r/math, I’ve been hunting for a solution to this for a while. I’ve gotten pretty far, but I’m up against some big topics and I’m hoping for a little help or direction to get me over the line. I’ve done some research, and found answers like this one, but I haven’t been able to fully grasp the answer and implement it for myself.
I understand combinatorics for the most part, but it’s the inclusion-exclusion principle where I start to get lost. For context, I’m working towards building a couple probability tables for a dice rolling mechanic for a tabletop RPG, so we can see how likely getting pairs on 4d6 is, or tripples on 5d8. I have written a script to brute force some of the smaller values (including the examples I just gave), but I know there’s a more elegant way, and now I’m just curious.
Any help would be greatly appreciated.