If we roll two dice, what are the odds that we roll one five OR the sum of the rolled dice equals an odd number?
The odds of rolling one five from two dice rolls is $\frac{1}{36}$. The odds of rolling an odd number from the sum of two rolls requires that we roll one even number from one die and an odd number from another die. The odds of this happening are $\frac{1}{2}$.
Therefore, the odds of either even occuring should be: $\frac{1}{36} + \frac{1}{2} = \frac{19}{36}$
However, this is incorrect. Apparently the answer is $\frac{23}{36}$. I do not understand why. I wrote a python script to evaluate my odds:
import random
def rolldice(count):
return [random.randint(1, 6) for i in range(count)]
def compute_odd(dice):
return sum(dice) % 2 == 1
def has_num_only(dice, num):
return dice.count(num) == 1
g_iEvents = 0
g_iSimulations = 8888
for i in range(g_iSimulations):
dice = rolldice(2)
if compute_odd(dice) or has_num_only(dice, 5):
g_iEvents += 1
print( float(g_iEvents) / float(g_iSimulations) )
print( g_iEvents )
print( g_iSimulations )
After several runs, I keep getting the answer of 61% - Therefore this is showing that both answers are incorrect.