Cody

# Problem 1471. Index of a Rational number

Solution 1929591

Submitted on 10 Sep 2019
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
p=1; q=3; y_correct = 6; assert(isequal(cantor_rational2index(p,q),y_correct))

l1 = 4 ans = 13

Output argument "k" (and maybe others) not assigned during call to "cantor_rational2index". Error in Test1 (line 3) assert(isequal(cantor_rational2index(p,q),y_correct))

2   Fail
p=2; q=3; y_correct = 9; assert(isequal(cantor_rational2index(p,q),y_correct))

l1 = 5 ans = 18

Output argument "k" (and maybe others) not assigned during call to "cantor_rational2index". Error in Test2 (line 3) assert(isequal(cantor_rational2index(p,q),y_correct))

3   Fail
p=22; q=7; y_correct = 385; assert(isequal(cantor_rational2index(p,q),y_correct))

l1 = 29 ans = 442

Output argument "k" (and maybe others) not assigned during call to "cantor_rational2index". Error in Test3 (line 3) assert(isequal(cantor_rational2index(p,q),y_correct))

4   Fail
p=355; q=113; y_correct = 108924; assert(isequal(cantor_rational2index(p,q),y_correct))

l1 = 468 ans = 109859

Output argument "k" (and maybe others) not assigned during call to "cantor_rational2index". Error in Test4 (line 3) assert(isequal(cantor_rational2index(p,q),y_correct))