Get any two positive integers. The probability of they are relatively prime numbers is 6/¦Ð2. Let¡¯s compute the ¦Ð through the probability tests.

Solution:

A | B | C | D | |

1 | 1000000 | 0 | ||

2 | for A1 | =int(rand()*100000)+1 | =int(rand()*100000)+1 | |

3 | >small=B2 | >big=C2 | ||

4 | if small>big | >small=C2 | ||

5 | >big=B2 | |||

6 | for small>0 | =big%small | ||

7 | >big=small | |||

8 | >small=C6 | |||

9 | if big==1 | >B1+=1 | ||

10 | =sqrt(6.0*A1/B1) |

The computation in A10 is shown below: