// you’re reading...
1 Star2 Stars3 Stars4 Stars5 Stars (28 votes, average: 5.00 out of 5)
Loading...

Project Euler Solutions

Project Euler 205 Solution

Project Euler 205 Solution

Project Euler 205: Comparing four-sided and six-sided dice


Project Euler 205 Problem Description

Project Euler 205: Peter has nine four-sided (pyramidal) dice, each with faces numbered 1, 2, 3, 4.
Colin has six six-sided (cubic) dice, each with faces numbered 1, 2, 3, 4, 5, 6.

Peter and Colin roll their dice and compare totals: the highest total wins. The result is a draw if the totals are equal.

What is the probability that Pyramidal Pete beats Cubic Colin? Give your answer rounded to seven decimal places in the form 0.abcdefg

Analysis

Ways to achieve sums on dice
Type 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
9 four-sided dice 0 0 0 1 9 45 165 486 1206 2598 4950 8451 13051 18351 23607 27876 30276
6 six-sided dice 1 6 21 56 126 252 456 756 1161 1666 2247 2856 3431 3906 4221 4332 4221
Ways to achieve sums on dice (continued)
Type 23 24 25 26 27 28 29 30 31 32 33 34 35 36
9 four-sided dice 30276 27876 23607 18351 13051 8451 4950 2598 1206 486 165 45 9 1
6 six-sided dice 3906 3431 2856 2247 1666 1161 756 456 252 126 56 21 6 1

After calculating the table above all that remains is finding the ratio of winning combinations to the total possible combinations. So the denominator will be (4^9)(6^6) and the numerator the total number of ways Pete out sums Colin (Pete’s index one more than Colin’s). Draws are inherently ignored, which was fortuitous.

Project Euler 205 Solution

Runs < 0.002 seconds in Python 2.7.
download arrowUse this link to get the Project Euler 205 Solution Python 2.7 source.

Afterthoughts


Project Euler 205

Project Euler 205

Project Euler 205 Solution last updated

Discussion

One Response to “Project Euler 205 Solution”

  1. How did you calculate the table of combinations?

    Posted by Jabroni Pepperoni | January 9, 2020, 6:31 AM

Post a comment