Cody

# Problem 1472. nth Rational Number

Solution 2133969

Submitted on 19 Feb 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
x = 6; y_correct = [1 3]; assert(isequal(cantor_index2rational(x),y_correct))

n = 3 Tn = 6 p = 1 q = 3

Assertion failed.

2   Fail
x = 385; y_correct = [22 7]; assert(isequal(cantor_index2rational(x),y_correct))

n = 27 Tn = 378 p = 22 q = 7

Assertion failed.

3   Fail
x=108924; y_correct = [355 113]; assert(isequal(cantor_index2rational(x),y_correct))

n = 466 Tn = 108811 p = 355 q = 113

Assertion failed.

4   Fail
x = 206; y_correct = [5 16]; assert(isequal(cantor_index2rational(x),y_correct))

n = 19 Tn = 190 p = 5 q = 16

Assertion failed.

5   Fail
x = 2060; y_correct = [21 44]; assert(isequal(cantor_index2rational(x),y_correct))

n = 63 Tn = 2016 p = 21 q = 44

Assertion failed.

6   Fail
x = 20604; y_correct = [103 101]; assert(isequal(cantor_index2rational(x),y_correct))

n = 202 Tn = 20503 p = 103 q = 101

Assertion failed.

7   Fail
x = 20704; y_correct = [3 201]; assert(isequal(cantor_index2rational(x),y_correct))

n = 202 Tn = 20503 p = 3 q = 201

Assertion failed.

8   Fail
x = 205704; y_correct = [58 584]; assert(isequal(cantor_index2rational(x),y_correct))

n = 640 Tn = 205120 p = 58 q = 584

Assertion failed.

9   Fail
x = 2085704; y_correct = [200 1843]; assert(isequal(cantor_index2rational(x),y_correct))

n = 2041 Tn = 2083861 p = 200 q = 1843

Assertion failed.

10   Fail
x = 20851704; y_correct = [4408 2051]; assert(isequal(cantor_index2rational(x),y_correct))

n = 6457 Tn = 20849653 p = 4408 q = 2051

Assertion failed.

11   Fail
x = 290851704; y_correct = [23437 683]; assert(isequal(cantor_index2rational(x),y_correct))

n = 24118 Tn = 290851021 p = 23437 q = 683

Assertion failed.