Coprime

发布时间: 2018年12月8日 20:11   最后更新: 2018年12月8日 20:12   时间限制: 1000ms   内存限制: 512M

Given an integer $n$, we suppose that $a, b$ are independent and uniform random integers on the interval $[1,n]$.

Calculate the probability where a and b are coprime.

Note: two integers are said to be coprime if the only positive factor that divides both of them is 1.

A single line with the integer $n(2 \le n \le 100)$.

Display the most simple fraction(which can be represented in the form of $p/q$, where p and q are coprime), representing the probability.

复制
2
3/4

On 3 cases a and b are coprime that:

$a = 1, b = 1;$

$a = 1, b = 2;$

$a = 2, b = 1$

while the total number of cases is 4.

2018 fdupc

2018 FDUPC 程序设计校赛现场赛(网络同步赛)