Hard Dice Probability Question

Alexi rolled four standard dice and lined them up to create a 4-digit number. He removed two dice from the line and rolled them again. Alexi then returned each re-rolled die to its original position in the line, thereby creating a new 4-digit number. The probability that the new 4-digit number is greater than the original 4-digit number can be expressed as a fraction a b \dfrac{a}{b} , where a a and b b are relatively prime integers. What is a a + b b ?


The answer is 107.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Satyen Nabar
Apr 14, 2015

The probability that the new number is greater is equal to the probability that the new number is lesser. Let it be be A A . Let the probability that the new number is same be B B

2 A + B = 1 2A + B= 1

The probability B B that the new number is the same is 1 6 1 6 = 1 36 \frac{1}{6}*\frac{1}{6}\ =\frac {1}{36}

Solving we have A = 35 72 A= \frac{35}{72}

Can you elaborate why "the probability that the new number is greater is equal to the probability that the new number is lesser"?

Jack Cornish - 6 years, 1 month ago

brilliant solution!

Ashish Sacheti - 4 years, 11 months ago
Rohit Sachdeva
Apr 16, 2015

Satyen's solution is simplest I guess. To elaborate on that lets look at it this way:

If original number was 11 (1,1) then there are 35 numbers greater than it (12,13,...21,22,....66)

If original number was 12 (1,2) then there are 34 numbers greater than it (13,14,.....66)

& so on till 66 which cannot have a number greater than that.

So our required number of cases are 35+34+33+.....1=35x36/2=35x18

Now total number of cases for original number can be 36, for which any 36 new(re-rolled) numbers are possible, which makes it 36x36

Our required probability=

35x18/36x36=35/72

Brock Brown
Apr 14, 2015

Python 2.7:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# method 1: monte carlo
from random import randint
from time import time
def roll():
    return randint(1,6)
def array_to_int(array):
    return int(''.join(str(i) for i in array))
def goal(first, new):
    return array_to_int(new) > array_to_int(first)
def more_than_first():
    first = []
    for i in xrange(4):
        first.append(roll())
    new = first[:]
    i1 = randint(0,3)
    i2 = i1
    # make sure dice are different
    while i1 == i2:
        i2 = randint(0,3)
    new[i1] = roll()
    new[i2] = roll()
    return goal(first,new)
trials = 0.0
count = 0.0
end = time() + 10
# run simulations for 10 seconds
while time() < end:
    if more_than_first():
        count += 1
    trials += 1
prob = count/trials
print "Probability is around", prob

# method 2: exact fraction
from fractions import Fraction as frac
from itertools import product
count = 0
trials = 0
first_rolls = product(xrange(1,7),repeat=4)
for first in first_rolls:
    for i1, i2 in product(xrange(4),repeat=2):
        if i1 < i2:
            second_rolls = product(xrange(1,7),repeat=2)
            for roll_a,roll_b in second_rolls:
                new = list(first[:])
                new[i1] = roll_a
                new[i2] = roll_b
                if goal(first,new):
                    count += 1
                trials += 1
prob = frac(count,trials)
print "Exact probability:", prob
answer = prob.numerator+prob.denominator
print "Answer:", answer

Please refrain from posting a computer assisted solution when one isn't required, especially when there's no actual correct solution posted.

Brilliant Mathematics Staff - 6 years, 2 months ago

Log in to reply

Why? I worked for that answer, and it confirms the author's original findings. I've noticed there's a lot of hostility against the use of programming to solve problems, but it's not like I'm going through the calculus section and plugging everything into Wolfram Alpha. Why does the method matter as long as everyone arrives at the same answer and everyone learns something along the way? Have I violated the sprit of the problem?

I guess my point is that I use this site mainly to practice programming, and it frustrates me when people tell me it's cheating (even though it is cheating on some level).

Brock Brown - 6 years, 2 months ago

Log in to reply

Sorry for not writing a clear comment. What I meant was that for problems where there is an underlying math structure, it is often better to understand it, which will allow you to apply it in more difficult scenarios which could even help to simplify your coding in future.

For example, if the question was asking to find a large matrix power, then certainly one way is to encode in the multiplication numerous times, which would then be extremely time consuming. The other approach would be to diagonalize the matrix, and then raise it to a large power, and then revert the change of basis.

Calvin Lin Staff - 6 years, 2 months ago

Log in to reply

@Calvin Lin Sorry, I misunderstood you. Thanks for the suggestion. You're right, my program probably would have used way less lines and would have been way more efficient if I understood the problem.

Brock Brown - 6 years, 1 month ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...