(via CotPi) 2012 --------- (One) Extra coin -------- Akio has one more coin than Bansi. They throw all of their coins and count the number of heads. If all the coins are fair, what is the probability that Akio obtainsmore heads than Bansi?
omg... this is a Great Problem!
pls tell me about another great problem about Coins or Dice.
On 01/10/2022 22:33, henh...@gmail.com wrote:
(via CotPi) 2012 --------- (One) Extra coin -------- Akio has one more coin than Bansi. They throw all of their coins and count the number of heads. If all the coins are fair, what is the probability that Akio obtains more heads than Bansi?
omg... this is a Great Problem!
pls tell me about another great problem about Coins or Dice.
[snip]
Spoiler space
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1/2
Assume the first coin thrown by Akio is a head. Then the probability
that Akio throws more heads than Bansi is the probability, P, that Akio throws at least as many heads as Bansi in the remaining n throws each.
Assume the first coin thrown by Akio is a tail. Then the probability
that Akio throws more heads than Bansi is the probability that Bansi
does not throw at least as many heads as Akio in the remaining n throws
each. As the coins are fair this equals 1-P.
1/2 * P + 1/2 * (1-P) = 1/2
A little Python to illustrate,
import random
def sim(n, its):
tot = 0
for _ in range(its):
A = bin(random.getrandbits(n+1)).count('1')
B = bin(random.getrandbits(n)).count('1')
tot += A > B
return tot / its
sim(1, 1000000)
0.500135
sim(40, 1000000)
0.499144
Duncan
On 01/10/2022 22:33, henh...@gmail.com wrote:
(via CotPi) 2012 --------- (One) Extra coin -------- Akio has one more coin than Bansi. They throw all of their coins and count the number of heads. If all the coins are fair, what is the probability that Akio obtains more heads than Bansi?
Spoiler space
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1/2
On Sunday, October 2, 2022 at 9:10:50 AM UTC-7, duncan smith wrote:
On 01/10/2022 22:33, henh...@gmail.com wrote:
[snip]
(via CotPi) 2012 --------- (One) Extra coin -------- Akio has one more coin than Bansi. They throw all of their coins and count the number of heads. If all the coins are fair, what is the probability that Akio obtains more heads than Bansi?
omg... this is a Great Problem!
pls tell me about another great problem about Coins or Dice.
Spoiler space
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1/2
Assume the first coin thrown by Akio is a head. Then the probability
that Akio throws more heads than Bansi is the probability, P, that Akio
throws at least as many heads as Bansi in the remaining n throws each.
Assume the first coin thrown by Akio is a tail. Then the probability
that Akio throws more heads than Bansi is the probability that Bansi
does not throw at least as many heads as Akio in the remaining n throws
each. As the coins are fair this equals 1-P.
1/2 * P + 1/2 * (1-P) = 1/2
A little Python to illustrate,
import random
def sim(n, its):
tot = 0
for _ in range(its):
A = bin(random.getrandbits(n+1)).count('1')
B = bin(random.getrandbits(n)).count('1')
tot += A > B
return tot / its
sim(1, 1000000)
0.500135
sim(40, 1000000)
0.499144
Duncan
(does [its] stand for something ?)
thanks.... i 'll study your Proof later....
----------------- ( i 'd never seen getrandbits before.)
for 3-sided and 6-sided Dice, i wonder if there's a similar invariant.
-------------- waht if Akio had to beat B by a margin of 1 ?
def dice(N, Sides, simN):
tot = 0
for _ in range(simN):
A,B= 0,0
for __ in range(N+1): A += random.randrange(Sides)
for ___ in range(N): B += random.randrange(Sides)
# tot += A > B
tot += A-1 > B
return tot / simN
Nsim=100000
for n in range(1,11): print('\t', "(2-sided)", n, ": ", dice(n, 2, Nsim))
print()
for n in range(1,11): print('\t', "(3-sided)", n, ": ", dice(n, 3, Nsim))
print()
for n in range(1,11): print('\t', "(6-sided)", n, ": ", dice(n, 6, Nsim))
On 01/10/2022 22:33, henh...@gmail.com wrote:
coin -------- Akio has one more coin than Bansi. They throw all of
(via CotPi) 2012 --------- (One) Extra
their coins and count the number of heads. If all the coins are fair,
what is the probability that Akio obtains more heads than Bansi?
omg... this is a Great Problem!
pls tell me about another great problem about Coins or Dice.
[snip]
Spoiler space
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1/2
Assume the first coin thrown by Akio is a head. Then the probability
that Akio throws more heads than Bansi is the probability, P, that Akio throws at least as many heads as Bansi in the remaining n throws each.
Assume the first coin thrown by Akio is a tail. Then the probability
that Akio throws more heads than Bansi is the probability that Bansi
does not throw at least as many heads as Akio in the remaining n throws
each. As the coins are fair this equals 1-P.
1/2 * P + 1/2 * (1-P) = 1/2
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 415 |
Nodes: | 16 (2 / 14) |
Uptime: | 117:42:46 |
Calls: | 8,696 |
Calls today: | 5 |
Files: | 13,259 |
Messages: | 5,949,422 |