Recently, YouTube started recommending videos for me from Standup Math S. Recently, I saw

this video which presented an interesting problem. Basically, it goes like this: You roll three indistinguishable dice, to the point that you don't even know the order in which they returned results. However, you want results as if you'd rolled 2d6. That means not only that the results range from 2 to 12, but also that they be distributed like 2d6, i.e., that the odds of getting 3 be twice the odds of getting 2, that the odds of getting 4 be the same as the odds of getting 2 or 3, etc. It's clearly possible with a lookup table, but the asker seeks a more elegant solution.

Last Friday at lunch, I came up with a

*fairly* elegant solution, but I've been pretty busy, so I haven't gotten a chance to post it until now. Here it is:

Let a, b, c represent the results of the dice, each an integer 1-6 inclusive, in any order.

f(a,b,c) =

- if a=b=c
- if a=b or b=c or c=a and max(a,b,c)+min(a,b,c)=7
- a≠b≠c≠a and either a=2i, b=2j, c=2k or a=2i+1, b=2j+1, c=2k+1, where i,j,k∈ℤ
- otherwise

In layman's terms:

- If you get triples, then the answer is 3.
- If you get doubles where low+high=7, then the answer is low+9 (a.k.a. high+low+low+2).
- If you get all 3 even numbers or all 3 odd numbers, then the answer is 2*low.
- Otherwise, add the highest and lowest numbers.

I think that this solution is fairly elegant, even though it's in the form of 4 branches, because it's something easily understood (it doesn't even require exponents or modular arithmetic, let alone anything actually complicated) and 2 of the 3 non-main branches (triples and jumping straights) are fairly rare, all 4 branches are easy to solve, and there's some work overlap: If you see doubles and add high+low to see if they're 7, if they're not, then you already did the math for your final answer.

And yes, I know that this is terribly informal and I didn't dig up all of the math symbols, but it's been a while since I did serious math, so I'm a bit rusty.

EDIT 2016/Apr/30: discovered and removed a touch of redundant text: I had parenthetically said, in "if a=b or b=c or c=a and max(a,b,c)+min(a,b,c)=7", "(but not a=b=c)", but the max and the min would have different parity, so, duh.

## No comments:

Post a Comment