Sorted Fractions
Statement
Goal
A fraction f = n/d is reduced if integers n and d are relatively prime. Given a range a to b, list all reduced fractions exclusively between 0 and 1, in order, with denominator a ≤ d ≤ b.Input
Line 1: Two space separated integers a and b
Output
First line: Smallest fraction in the form n/d
...
Last line: Largest fraction in the form n/d
...
Last line: Largest fraction in the form n/d
Constraints
1 < a ≤ b < 25
Example
Input
2 4
Output
1/4 1/3 1/2 2/3 3/4
Game modes
Fastest, Shortest, Reverse
Test cases
Lower Range Test
Input
2 4
Output
1/4
1/3
1/2
2/3
3/4
Validator 1 Validator
Input
4 6
Output
1/6
1/5
1/4
2/5
3/5
3/4
4/5
5/6
Single Prime Value Test
Input
7 7
Output
1/7
2/7
3/7
4/7
5/7
6/7
Validator 2 Validator
Input
13 13
Output
1/13
2/13
3/13
4/13
5/13
6/13
7/13
8/13
9/13
10/13
11/13
12/13
Single Composite Value Test
Input
12 12
Output
1/12
5/12
7/12
11/12
Validator 3 Validator
Input
18 18
Output
1/18
5/18
7/18
11/18
13/18
17/18
Higher Range Test
Input
8 10
Output
1/10
1/9
1/8
2/9
3/10
3/8
4/9
5/9
5/8
7/10
7/9
7/8
8/9
9/10
Validator 4 Validator
Input
14 16
Output
1/16
1/15
1/14
2/15
3/16
3/14
4/15
5/16
5/14
7/16
7/15
8/15
9/16
9/14
11/16
11/15
11/14
13/16
13/15
13/14
14/15
15/16
Long Range Test
Input
2 20
Output
1/20
1/19
1/18
1/17
1/16
1/15
1/14
1/13
1/12
1/11
1/10
2/19
1/9
2/17
1/8
2/15
1/7
3/20
2/13
3/19
1/6
3/17
2/11
3/16
1/5
4/19
3/14
2/9
3/13
4/17
1/4
5/19
4/15
3/11
5/18
2/7
5/17
3/10
4/13
5/16
6/19
1/3
7/20
6/17
5/14
4/11
7/19
3/8
5/13
7/18
2/5
7/17
5/12
8/19
3/7
7/16
4/9
9/20
5/11
6/13
7/15
8/17
9/19
1/2
10/19
9/17
8/15
7/13
6/11
11/20
5/9
9/16
4/7
11/19
7/12
10/17
3/5
11/18
8/13
5/8
12/19
7/11
9/14
11/17
13/20
2/3
13/19
11/16
9/13
7/10
12/17
5/7
13/18
8/11
11/15
14/19
3/4
13/17
10/13
7/9
11/14
15/19
4/5
13/16
9/11
14/17
5/6
16/19
11/13
17/20
6/7
13/15
7/8
15/17
8/9
17/19
9/10
10/11
11/12
12/13
13/14
14/15
15/16
16/17
17/18
18/19
19/20
Validator 5 Validator
Input
3 21
Output
1/21
1/20
1/19
1/18
1/17
1/16
1/15
1/14
1/13
1/12
1/11
2/21
1/10
2/19
1/9
2/17
1/8
2/15
1/7
3/20
2/13
3/19
1/6
3/17
2/11
3/16
4/21
1/5
4/19
3/14
2/9
3/13
4/17
5/21
1/4
5/19
4/15
3/11
5/18
2/7
5/17
3/10
4/13
5/16
6/19
1/3
7/20
6/17
5/14
4/11
7/19
3/8
8/21
5/13
7/18
2/5
7/17
5/12
8/19
3/7
7/16
4/9
9/20
5/11
6/13
7/15
8/17
9/19
10/21
11/21
10/19
9/17
8/15
7/13
6/11
11/20
5/9
9/16
4/7
11/19
7/12
10/17
3/5
11/18
8/13
13/21
5/8
12/19
7/11
9/14
11/17
13/20
2/3
13/19
11/16
9/13
7/10
12/17
5/7
13/18
8/11
11/15
14/19
3/4
16/21
13/17
10/13
7/9
11/14
15/19
4/5
17/21
13/16
9/11
14/17
5/6
16/19
11/13
17/20
6/7
13/15
7/8
15/17
8/9
17/19
9/10
19/21
10/11
11/12
12/13
13/14
14/15
15/16
16/17
17/18
18/19
19/20
20/21
Solution language
Solution
Stub generator input