编程介的小学生 2017-11-06 13:14 采纳率: 20.5%
浏览 548
已结题

Farey Sequence Again

Problem Description
The Farey sequence Fn for any positive integer n is the set of irreducible rational numbers a/b with 0<a<b<=n and (a, b) = 1 arranged in increasing order. Here (a, b) mean the greatest common divisor of a and b. For example:
F2 = {1/2}
F3 = {1/3, 1/2, 2/3}
Given two positive integers N and K, with K less than N, you need to find out the K-th smallest element of the Farey sequence FN.

Input
The first line of input is the number of test case T, 1<=T<=1000. Then each test case contains two positive integers N and K. 1<=K<N<=10^9.

Output
For each test case output the Kth smallest element of the Farey sequence FN in a single line.

Sample Input
3
2 1
100 68
101 69

Sample Output
1/2
2/83
1/42

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Java中消息和缓存如何使用
    • ¥50 易语言把MYSQL数据库中的数据添加至组合框
    • ¥20 求数据集和代码#有偿答复
    • ¥15 关于下拉菜单选项关联的问题
    • ¥20 java-OJ-健康体检
    • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
    • ¥15 使用phpstudy在云服务器上搭建个人网站
    • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
    • ¥15 vue3+express部署到nginx
    • ¥20 搭建pt1000三线制高精度测温电路