Cody

Solution 966425

Submitted on 13 Sep 2016 by Aaron
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   Pass
p=1; q=3; y_correct = 6; assert(isequal(cantor_rational2index(p,q),y_correct))

S = 1 S = 1 2 S = 1 2 4 k = 6

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

S = 1 S = 1 2 S = 1 2 4 S = 1 2 4 7 k = 9

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

S = 1 S = 1 2 S = 1 2 4 S = 1 2 4 7 S = 1 2 4 7 11 S = 1 2 4 7 11 16 S = 1 2 4 7 11 16 22 S = 1 2 4 7 11 16 22 29 S = 1 2 4 7 11 16 22 29 37 S = 1 2 4 7 11 16 22 29 37 46 S = 1 2 4 7 11 16 22 29 37 46 56 S = 1 2 4 7 11 16 22 29 37 46 56 67 S = 1 2 4 7 11 16 22 29 37 46 56 67 79 S = 1 2 4 7 11 16 22 29 37 46 56 67 79 92 S = 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 S = 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Column 17 137 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 18 137 154 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 19 137 154 172 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 20 137 154 172 191 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 21 137 154 172 191 211 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 22 137 154 172 191 211 232 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 23 137 154 172 191 211 232 254 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 24 137 154 172 191 211 232 254 277 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 25 137 154 172 191 211 232 254 277 301 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 26 137 154 172 191 211 232 254 277 301 326 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 27 137 154 172 191 211 232 254 277 301 326 352 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 28 137 154 172 191 211 232 254 277 301 326 352 379 k = 385

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

S = 1 S = 1 2 S = 1 2 4 S = 1 2 4 7 S = 1 2 4 7 11 S = 1 2 4 7 11 16 S = 1 2 4 7 11 16 22 S = 1 2 4 7 11 16 22 29 S = 1 2 4 7 11 16 22 29 37 S = 1 2 4 7 11 16 22 29 37 46 S = 1 2 4 7 11 16 22 29 37 46 56 S = 1 2 4 7 11 16 22 29 37 46 56 67 S = 1 2 4 7 11 16 22 29 37 46 56 67 79 S = 1 2 4 7 11 16 22 29 37 46 56 67 79 92 S = 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 S = 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Column 17 137 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 18 137 154 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 19 137 154 172 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 20 137 154 172 191 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 21 137 154 172 191 211 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 22 137 154 172 191 211 232 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 23 137 154 172 191 211 232 254 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 24 137 154 172 191 211 232 254 277 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 25 137 154 172 191 211 232 254 277 301 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 26 137 154 172 191 211 232 254 277 301 326 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 27 137 154 172 191 211 232 254 277 301 326 352 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 28 137 154 172 191 211 232 254 277 301 326 352 379 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 29 137 154 172 191 211 232 254 277 301 326 352 379 407 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 30 137 154 172 191 211 232 254 277 301 326 352 379 407 436 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 31 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Column 33 529 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 34 529 562 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 35 529 562 596 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 36 529 562 596 631 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 37 529 562 596 631 667 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 38 529 562 596 631 667 704 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 39 529 562 596 631 667 704 742 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 40 529 562 596 631 667 704 742 781 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 41 529 562 596 631 667 704 742 781 821 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 42 529 562 596 631 667 704 742 781 821 862 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 43 529 562 596 631 667 704 742 781 821 862 904 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 44 529 562 596 631 667 704 742 781 821 862 904 947 S = Columns 1 through 16 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 Columns 17 through 32 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 Columns 33 through 45 529 562 596 631 667 704 742 781 821 862 904 947 991 S = Columns 1 through 8 1 2 4 7 11 16 22 29 Columns 9 through 16 37 46 56 67 79 92 106 121 Columns 17 through 24 137 154 172 191 211 232 254 277 Columns 25 through 32 301 326 352 379 407 436 466 497 Columns 33 through 40 529 562 596 631 667 704 742 781 Columns 41 through 46 821 862 904 947 991 1036 S = Columns 1 through 8 1 2 4 7 11 16 22 29 Columns 9 through 16 37 46 56 67 79 92 106 121 Columns 17 through 24 137 154 172 191 211 232 254 277 Columns 25 through 32 301 326 352 379 407 436 466 497 Columns 33 through 40 529 562 596 631 667 704 742 781 Columns 41 through 47 821 862 904 947 991 1036 1082 S = Columns 1 through 8 1 2 4 7 11 16 22 29 Columns 9 through 16 37 46 ...

Suggested Problems

More from this Author10