#P8058. [BalkanOI 2003] Farey 序列
[BalkanOI 2003] Farey 序列
Problem Description
Arrange all reduced proper fractions whose numerator and denominator are both in increasing order. The resulting sequence is called the Farey sequence.
Find the -th smallest number in the Farey sequence for the given .
Input Format
One line with two integers .
Output Format
One line with two integers , representing the answer .
5 6
3 5
Hint
For of the testdata, , and the number of fractions that satisfy the conditions.
Translated by ChatGPT 5