You face an urn with 5555 cards in it, each has a non-zero integer written on it. Nothing is said about the distribution of those numbers. You are told to draw randomly a card, copy the number, return it back, shuffle and draw randomly a card, then write down the sum of both numbers, say S.
(i) Prove: The probability of S being an even number is higher than S being odd.
(ii) Is it true for any initial number of cards? Comment.
The probabilities from 1 to 10 cards are:
1 1 1.0
2 3//4 0.75
3 2//3 0.6666666666666666666
4 5//8 0.625
5 3//5 0.6
6 7//12 0.5833333333333333333
7 4//7 0.5714285714285714285
8 9//16 0.5625
9 5//9 0.5555555555555555555
10 11//20 0.55
Unfortunately there's an overflow for such large numbers as 5555 even in UBASIC. We could work around this using logarithms, but the point has been made.
from
5 kill "oddsare.txt"
10 open "oddsare.txt" for output as #2
20 for n=1 to 10
30 tot=0
40 for i=0 to int(n/2)
45 if i<n//2 then
50 :condp=(1//2)^n * combi(n,i)*2
55 :else
56 :condp=(1//2)^n * combi(n,i)
70 p=condp*((i//n)^2+((n-i)//n)^2)
80 tot=tot+p
90 next
150 print n,tot,tot/1
160 print #2, n,tot,tot/1
170 next n
180 close #2
|
Posted by Charlie
on 2017-02-14 11:34:26 |