Saturday, April 30, 2016

Regarding The Three Indistinguishable Dice Puzzle: Reasoning

In my previous post, I gave my solution to the problem presented here, but I thought that it would be good to show the logic behind how I got the solution that I got. 
In the quest for an elegant solution, I was playing around with various functions over a,b,c.  One that I thought would be a good starting point was max(a,b,c)+min(a,b,c), since it would give a number 2 through 12 and wouldn't be biased upwards or downwards, since the median of a,b,c was what was being ignored.  I noticed that the distribution of results, if triples were ignored, was, indeed, symmetrical around 7, with 6, 7, and 8 occurring too often by multiples of 6, and with 2, 3, 4, 10, 11, 12 occurring too rarely by multiples of 6.  Of course, on this map, the excess from 6, 7, and 8 was 6 short of the deficit from the rest, but that's made up when we add the triples back in. 
I then looked at the patterns of groups that would result in 6, 7, or 8 and tried to find elegant ways to migrate them to the results that were coming up short.  This was pretty much trial and error, so one thing that I did was aim to end up with a rule saying that three of a kind makes 3, since that would be easy to remember. 
Any set of non-triples a,b,c is either a pair and another digit, which occurs 3 times out of every 216, or three different digits, which occurs 6 times out of every 216, so it was easy to move these things in whole lots of 6, and even to move them in lots of 3.  For instance, the rule that, if max(a,b,c)+min(a,b,c)=7 and a=b or b=c or c=a, then f(a,b,c)=min(a,b,c)+9 actually migrates pair of sets of 3, such as causing f(6,6,1) (or 6,1,6 or 1,6,6) and f(6,1,1) (or 1,6,1 or 1,1,6) to both be 10. 
So, hey, if you want to make a more elegant variation of my solution, mess around with ways to twist a,b,c where 5<max(a,b,c)+min(a,b,c)<9 to give the right number of missing results for 2,3,4,10,11,12 and put the triples somewhere and see if you can make one that uses fewer rules. 
Caveat:  Elegance is a matter of opinion.  I'm pretty sure that what I devised uses the simplest rules (though I could be wrong), so I'd anticipate that the other way to make a more elegant solution would be to have no if conditionals at all, though it probably involves math that's harder to do on the spot.  (I'm almost certain that such a solution would involve modular arithmetic, too, but I haven't actually looked at anyone else's solutions yet.)  So, I'd expect a "more elegant" variant of my solution to get it down to 3 or 2 rules, instead of my current 4. 
OK, have fun with that. 

No comments: