A Curious Probability 2

What is the probability of selecting 4 pairwise coprime positive integers?


The answer is 0.1149.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Bill Bell
Sep 5, 2015
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from random import sample
from fractions import gcd
from itertools import combinations

N=1000000
count=0
for n in range(N):
    four=sample(range(1,1001),4)
    count+=0 if any(gcd(a,b)!=1 for a,b in combinations(four,2)) else 1
print 1.*count/N

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...