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?
considering x and y as random continuous variables from the uniform distribution on (0,1) and then plotting (x,y) we can see what's going on.
The number will round to 0 if in the triangle bounded by x=0 and y=2x which has area 1/4.
It will round to 2 if bounded by y=2x/3 and y=2x/5 which has area (1/3-1/5)=2/15.
It will round to 4 if bounded by y=2x/7 and y=2x/9 which has area (1/7-1/9)=2/63.
Thia leads to the series 1/(4n-1)-1/(4n+1) which wolfram gives as (4-pi)/5. Add in the 1/4 and we get (5-pi)/4 or about 0.4646018
The discrete case will differ slightly. (It's a bit annoying there are 999,999 values of x and of y, so the denominator will be an annoying 999,998,000,001 instead of a nice even trillion.) The numerator should be close to 4.646x10^11.
Also, to get an answer in the discrete case, we will need agree on how rounding to the nearest integer should work. Mathworld says using the nint function, integer+.5 should always go to the nearest even integer. https://mathworld.wolfram.com/NearestIntegerFunction.html
|
Posted by Jer
on 2024-03-06 13:47:33 |