Cody

# Problem 42495. N-th permutation.

Solution 1673648

Submitted on 14 Nov 2018
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 = 1; y_correct = []; assert(isempty(whichperm(x)))

1

Undefined function or variable 'd'. Error in whichperm (line 5) y_correct = [d]; Error in Test1 (line 3) assert(isempty(whichperm(x)))

2   Pass
x = 2; y_correct = 2; assert(isequal(whichperm(x),y_correct))

2

3   Pass
x = 3; y_correct = [1 3]; assert(isequal(whichperm(x),y_correct))

3

4   Pass
x = 4; y_correct = [2 3]; assert(isequal(whichperm(x),y_correct))

4

5   Pass
x = 5; y_correct = 3; assert(isequal(whichperm(x),y_correct))

5

6   Pass
x = 10; y_correct = [2 3 4]; assert(isequal(whichperm(x),y_correct))

10

7   Pass
x = 9; y_correct = [1 3 4]; assert(isequal(whichperm(x),y_correct))

9

8   Pass
x = 323; y_correct = [3 5 1 6 4]; assert(isequal(whichperm(x),y_correct))

323

9   Pass
x = 2015; y_correct = [4 6 5 3 7]; assert(isequal(whichperm(x),y_correct))

2015

10   Pass
x = 2016; y_correct = [4 6 5 3 7 2]; assert(isequal(whichperm(x),y_correct))

2016

11   Pass
x = 1234567890; y_correct = [11 7 3 5 6 12 4 2 8 10 13 9]; assert(isequal(whichperm(x),y_correct))

1.2346e+09

12   Pass
x = 720; y_correct = [6 5 4 3 2]; assert(isequal(whichperm(x),y_correct))

720

13   Pass
x = 721; y_correct = [1 2 3 4 5 7]; assert(isequal(whichperm(x),y_correct))

721

14   Pass
x = 13; y_correct = [1 4]; assert(isequal(whichperm(x),y_correct))

13

15   Pass
x = 100; y_correct = [5 2 3]; assert(isequal(whichperm(x),y_correct))

100

16   Pass
x = 100000000; y_correct = [6 2 4 9 10 11 3 5 7 12 8]; assert(isequal(whichperm(x),y_correct))

100000000

17   Pass
x = 439084801; y_correct = [12]; assert(isequal(whichperm(x),y_correct))

439084801

18   Fail
x = flintmax; y_correct = [15 12 11 2 1 10 9 4 16 5 18 3 17 14 8 6 7 19]; assert(isequal(whichperm(x),y_correct))

9.0072e+15

Assertion failed.