Two integers x and y are chosen at random in the interval (0, 1,000,000) with respect to the
uniform distribution.
What is the probability that the closest integer to x/y is even?
Since 0 is included, some cases will occur where 0 is in the denominator.
Also, it is unclear how ratios ending in .5 should be treated: traditional rounding says to round up. But 0.5 is exactly the same distance from 0 or from 1. The problem doesn't ask for classing rounding, it asks for "the closest integer". Anyway, both interpretations are covered.
So I did a randomization (1 million iterations) and kept track of four categories:
Even, Odd, Half, DivideByZero
464837 535156 7 0
Even / (Even + Odd) = 0.4648402538817772
(Even + Half) / (Even + Half + Odd) = 0.464844
|
Posted by Larry
on 2024-03-06 14:43:58 |