Codeforces 395B. On Sum of Fractions(数学,素数间隔)

Let’s assume that

  • v(n) is the largest prime number, that does not exceed n;
  • u(n) is the smallest prime number strictly greater than n.

Find .

Input

The first line contains integer t (1 ≤ t ≤ 500) — the number of testscases.

Each of the following t lines of the input contains integer n (2 ≤ n ≤ 109).

Output

Print t lines: the i-th of them must contain the answer to the i-th test as an irreducible fraction “p/q“, where p, q are integers, q > 0.

Examples
input

output

看到式子后展开了一下,1/(2*3)+2/(3*5)+…..大概长这样,发现貌似很好消。。假如说n处于自己的u(n)和v(n)之间的话,大概化简了一下式子。现在我们就是求v(n)和u(n)的问题了。。其实这个暴力就可以了,因为1e9范围内相邻素数间隔不超过800左右。

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注