Okay, given the overwhelming response and outpouring of accolades generated by the
first time I did something like this, and my burning curiosity on the subject, I decided to figure out the exact average of the best three out of four d6. (For those of you unfamiliar with non-layo D&D, often three out of four regular six sided dice is used to assign a character's abilities)
Sooo... I decided that the best way to go about this was, rather than calculate the roll as a whole, just to concentrate on the discarded die, and figure out the value of the average low die, and then subtract that from 14, which is the average of four dice.
With that decided, the problem becomes counting: I needed to figure out how many times a given value is the lowest die, then multiply that by the value, and add those numbers together:
So, I started at the top, because I knew there would be fewer, and thus it is easier to count.
The first one is real easy... six is the lowest die exactly one time: when all four dice are sixes.
1x6=6
yay.
Now, with five, it gets a little more complicated. To organize things (which will come in handy in a bit), we will separate things by how many fives turn up. (In mathematical terms we are "choosing" successive numbers out of four)
There is one case where there are four fives and five is the lowest number: (5555)
Four where there are three fives (5556), (5565), (5655), (6555)
Six where there are two: (5566),(5656),(5665),(6556),(6565),(6655)
and Four where there are one: (5666),(6566),(6656),(6665)
In math terms:
4 choose 1 = 4
4 choose 2 = 6
4 choose 3 = 4
4 choose 4 = 1
That's fifteen ways (4+6+4+1) that a five is the lowest die, and 15x5=75
Okay, I don't know about the rest of you, but I'm lazy, and counting the fives in my head is about my limit, so I'm going to have to figure out something better to use for the fours and below.
So, if I look at what I've written out in the fives, I can see that the other numbers will follow that pattern. Incidentally, the 4,6,4,1 pattern is part of pascal's triangle (the fourth line, because there are four dice), and crops up in various other things. With 5, there was only one other number to consider, but with four and below, we have to multiply the number of ways the number we're looking at can occur, by all the permutations of however many larger numbers there are. Luckily, permutations is easy to figure out. We just have to take the number of dice we are looking at, to the power of the available slots.
For example, take the specific case where there are three fours: there are two numbers greater than four (five and six, in case you have trouble counting), and one available slot. So, we have (2^1)(4 choose 3) = 2x4=8
We can confirm this by counting them out:
(4445),(4446),(4454),(4464),(4544),(4644),(5444),(6444)
Now we have a general rule for four six-sided dice (I have this written in formal summation notation on a post-it note, but don't know how to display math symbols on the forum): The sum from one to six of each value multiplied by the sum from one to four (we'll call it n) of six minus the die value to the four minus n power, multiplied by four choose n.
Because that's a mouthful, (and probably not terribly well stated) here's the actual numbers:
1[(5^3)4+(5^2)6+(5^1)4+(5^0)1]
+2[(4^3)4+(4^2)6+(4^1)4+(4^0)1]
+3[(3^3)4+(3^2)6+(3^1)4+(3^0)1]
+4[(2^3)4+(2^2)6+(2^1)4+(2^0)1]
+5[(1^3)4+(1^2)6+(1^1)4+(1^0)1]
+6[(0^3)4+(0^2)6+(0^1)4+(0^0)1]
Performing the calculations, 671 + 738 + 525 + 260 + 75 + 6 = 2274
So, dividing 2274 by the total number of possible rolls which is 6^4, or 1296, we get about 1.745
As we said at the top, we subtract that from the average of four dice which is fourteen, so 14-1.745 = 12.245
There's what we've been looking for: the average of the best three out of four d6 is about
12.25Whew!
Of course, it's no fun to end there.... what if we needed to rollthe best 7 out of 8 d10 instead? We can generalize to the best x out of x+1 dice of any number of faces..
(We could potentially generalize to the best x out of y, but that would need an addition summation, and would be much much more complicated, and it's messy enough as it is. Also, we could make it look a lot neater using summation notation). We'll call the number of faces d, the number of dice n, and designate xCy as the choose function, x choose y.
1[((d-1)^(n-1))(n)+((d-1)^(n-2))(nC2)+ . . . +((d-1)^2)(nCn-2)+((d-1)^1)(nCn-1)+((d-1)^0)1]
+2[((d-2)^(n-1))(n)+((d-2)^(n-2))(nC2)+ . . . +((d-2)^2)(nCn-2)+((d-2)^1)(nCn-1)+((d-2)^0)1]
+3[((d-3)^(n-1))(n)+((d-3)^(n-2))(nC2)+ . . . +((d-3)^2)(nCn-2)+((d-3)^1)(nCn-1)+((d-3)^0)1]
+
.
.
.
+(d-1)[(1^(n-1))(n)+(1^(n-2))(nC2)+ . . . +(1^2)(nCn-2)+(1^1)(nCn-1)+(1^0)1)]
+d[a bunch of stuff I don't feel like writing out but equals 1]
Wasn't that exciting?