Cody

Solution 2148411

Submitted on 2 Mar 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   Pass
assert(isequal(nextComb([1 2 3],5),[1 2 4]))

v = 1 2 3 1 2 4 1 2 5 1 3 4 1 3 5 1 4 5 2 3 4 2 3 5 2 4 5 3 4 5 check = logical 1

2   Pass
assert(isequal(nextComb([2 4 5],5),[3 4 5]))

v = 1 2 3 1 2 4 1 2 5 1 3 4 1 3 5 1 4 5 2 3 4 2 3 5 2 4 5 3 4 5 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 1

3   Pass
assert(isequal(nextComb([3 4 5],5),[3 4 5])) % if it is the last combination in the list; return itself

v = 1 2 3 1 2 4 1 2 5 1 3 4 1 3 5 1 4 5 2 3 4 2 3 5 2 4 5 3 4 5 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 1

4   Pass
assert(isequal(nextComb([1 3 4 5],5),[2 3 4 5]))

v = 1 2 3 4 1 2 3 5 1 2 4 5 1 3 4 5 2 3 4 5 check = logical 0 check = logical 0 check = logical 0 check = logical 1

5   Pass
assert(isequal(nextComb([5 6 7 10],10),[5 6 8 9]))

v = 1 2 3 4 1 2 3 5 1 2 3 6 1 2 3 7 1 2 3 8 1 2 3 9 1 2 3 10 1 2 4 5 1 2 4 6 1 2 4 7 1 2 4 8 1 2 4 9 1 2 4 10 1 2 5 6 1 2 5 7 1 2 5 8 1 2 5 9 1 2 5 10 1 2 6 7 1 2 6 8 1 2 6 9 1 2 6 10 1 2 7 8 1 2 7 9 1 2 7 10 1 2 8 9 1 2 8 10 1 2 9 10 1 3 4 5 1 3 4 6 1 3 4 7 1 3 4 8 1 3 4 9 1 3 4 10 1 3 5 6 1 3 5 7 1 3 5 8 1 3 5 9 1 3 5 10 1 3 6 7 1 3 6 8 1 3 6 9 1 3 6 10 1 3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 8 9 3 7 8 10 3 7 9 10 3 8 9 10 4 5 6 7 4 5 6 8 4 5 6 9 4 5 6 10 4 5 7 8 4 5 7 9 4 5 7 10 4 5 8 9 4 5 8 10 4 5 9 10 4 6 7 8 4 6 7 9 4 6 7 10 4 6 8 9 4 6 8 10 4 6 9 10 4 7 8 9 4 7 8 10 4 7 9 10 4 8 9 10 5 6 7 8 5 6 7 9 5 6 7 10 5 6 8 9 5 6 8 10 5 6 9 10 5 7 8 9 5 7 8 10 5 7 9 10 5 8 9 10 6 7 8 9 6 7 8 10 6 7 9 10 6 8 9 10 7 8 9 10 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical...

6   Pass
assert(isequal(nextComb([2 3 4 5 10],10),[2 3 4 6 7]))

v = 1 2 3 4 5 1 2 3 4 6 1 2 3 4 7 1 2 3 4 8 1 2 3 4 9 1 2 3 4 10 1 2 3 5 6 1 2 3 5 7 1 2 3 5 8 1 2 3 5 9 1 2 3 5 10 1 2 3 6 7 1 2 3 6 8 1 2 3 6 9 1 2 3 6 10 1 2 3 7 8 1 2 3 7 9 1 2 3 7 10 1 2 3 8 9 1 2 3 8 10 1 2 3 9 10 1 2 4 5 6 1 2 4 5 7 1 2 4 5 8 1 2 4 5 9 1 2 4 5 10 1 2 4 6 7 1 2 4 6 8 1 2 4 6 9 1 2 4 6 10 1 2 4 7 8 1 2 4 7 9 1 2 4 7 10 1 2 4 8 9 1 2 4 8 10 1 2 4 9 10 1 2 5 6 7 1 2 5 6 8 1 2 5 6 9 1 2 5 6 10 1 2 5 7 8 1 2 5 7 9 1 2 5 7 10 1 2 5 8 9 1 2 5 8 10 1 2 5 9 10 1 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6 7 8 9 10 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical ...

7   Pass
assert(isequal(nextComb([5 7 8 9 10],10),[6 7 8 9 10]))

v = 1 2 3 4 5 1 2 3 4 6 1 2 3 4 7 1 2 3 4 8 1 2 3 4 9 1 2 3 4 10 1 2 3 5 6 1 2 3 5 7 1 2 3 5 8 1 2 3 5 9 1 2 3 5 10 1 2 3 6 7 1 2 3 6 8 1 2 3 6 9 1 2 3 6 10 1 2 3 7 8 1 2 3 7 9 1 2 3 7 10 1 2 3 8 9 1 2 3 8 10 1 2 3 9 10 1 2 4 5 6 1 2 4 5 7 1 2 4 5 8 1 2 4 5 9 1 2 4 5 10 1 2 4 6 7 1 2 4 6 8 1 2 4 6 9 1 2 4 6 10 1 2 4 7 8 1 2 4 7 9 1 2 4 7 10 1 2 4 8 9 1 2 4 8 10 1 2 4 9 10 1 2 5 6 7 1 2 5 6 8 1 2 5 6 9 1 2 5 6 10 1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 4 7 8 9 10 5 6 7 8 9 5 6 7 8 10 5 6 7 9 10 5 6 8 9 10 5 7 8 9 10 6 7 8 9 10 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical ...

8   Pass
assert(isequal(nextComb([8 10 17 19 20],20),[8 10 18 19 20]))

v = 1 2 3 4 5 1 2 3 4 6 1 2 3 4 7 1 2 3 4 8 1 2 3 4 9 1 2 3 4 10 1 2 3 4 11 1 2 3 4 12 1 2 3 4 13 1 2 3 4 14 1 2 3 4 15 1 2 3 4 16 1 2 3 4 17 1 2 3 4 18 1 2 3 4 19 1 2 3 4 20 1 2 3 5 6 1 2 3 5 7 1 2 3 5 8 1 2 3 5 9 1 2 3 5 10 1 2 3 5 11 1 2 3 5 12 1 2 3 5 13 1 2 3 5 14 1 2 3 5 15 1 2 3 5 16 1 2 3 5 17 1 2 3 5 18 1 2 3 5 19 1 2 3 5 20 1 2 3 6 7 1 2 3 6 8 1 2 3 6 9 1 2 3 6 10 1 2 3 6 11 1 2 3 6 12 1 2 3 6 13 1 2 3 6 14 1 2 3 6 15 1 2 3 6 16 1 2 3 6 17 1 2 3 6 18 1 2 3 6 19 1 2 3 6 20 1 2 3 7 8 1 2 3 7 9 1 2 3 7 10 1 2 3 7 11 1 2 3 7 12 1 2 3 7 13 1 2 3 7 14 1 2 3 7 15 1 2 3 7 16 1 2 3 7 17 1 2 3 7 18 1 2 3 7 19 1 2 3 7 20 1 2 3 8 9 1 2 3 8 10 1 2 3 8 11 1 2 3 8 12 1 2 3 8 13 1 2 3 8 14 1 2 3 8 15 1 2 3 8 16 1 2 3 8 17 1 2 3 8 18 1 2 3 8 19 1 2 3 8 20 1 2 3 9 10 1 2 3 9 11 1 2 3 9 12 1 2 3 9 13 1 2 3 9 14 1 2 3 9 15 1 2 3 9 16 1 2 3 9 17 1 2 3 9 18 1 2 3 9 19 1 2 3 9 20 1 2 3 10 11 1 2 3 10 12 1 2 3 10 13 1 2 3 10 14 1 2 3 10 15 1 2 3 10 16 1 2 3 10 17 1 2 3 10 18 1 2 3 10 19 1 2 3 10 20 1 2 3 11 12 1 2 3 11 13 1 2 3 11 14 1 2 3 11 15 1 2 3 11 16 1 2 3 11 17 1 2 3 11 18 1 2 3 11 19 1 2 3 11 20 1 2 3 12 13 1 2 3 12 14 1 2 3 12 15 1 2 3 12 16 1 2 3 12 17 1 2 3 12 18 1 2 3 12 19 1 2 3 12 20 1 2 3 13 14 1 2 3 13 15 1 2 3 13 16 1 2 3 13 17 1 2 3 13 18 1 2 3 13 19 1 2 3 13 20 1 2 3 14 15 1 2 3 14 16 1 2 3 14 17 1 2 3 14 18 1 2 3 14 19 1 2 3 14 20 1 2 3 15 16 1 2 3 15 17 1 2 3 15 18 1 2 3 15 19 1 2 3 15 20 1 2 3 16 17 1 2 3 16 18 1 2 3 16 19 1 2 3 16 20 1 2 3 17 18 1 2 3 17 19 1 2 3 17 20 1 2 3 18 19 1 2 3 18 20 1 2 3 19 20 1 2 4 5 6 1 2 4 5 7 1 2 4 5 8 1 2 4 5 9 1 2 4 5 10 1 2 4 5 11 1 2 4 5 12 1 2 4 5 13 1 2 4 5 14 1 2 4 5 15 1 2 4 5 16 1 2 4 5 17 1 2 4 5 18 1 2 4 5 19 1 2 4 5 20 1 2 4 6 7 1 2 4 6 8 1 2 4 6 9 1 2 4 6 10 1 2 4 6 11 1 2 4 6 12 1 2 4 6 13 1 2 4 6 14 1 2 4 6 15 1 2 4 6 16 1 2 4 6 17 1 2 4 6 18 1 2 4 6 19 1 2 4 6 20 1 2 4 7 8 1 2 4 7 9 1 2 4 7 10 1 2 4 7 11 1 2 4 7 12 1 2 4 7 13 1 2 4 7 14 1 2 4 7 15 1 2 4 7 16 1 2 4 7 17 1 2 4 7 18 1 2 4 7 19 1 2 4 7 20 1 2 4 8 9 1 2 4 8 10 1 2 4 8 11 1 2 4 8 12 1 2 4 8 13 1 2 4 8 14 1 2 4 8 15 1 2 4 8 16 1 2 4 8 17 1 2 4 8 18 1 2 4 8 19 1 2 4 8 20 1 2 4 9 10 1 2 4 9 11 1 2 4 9 12 1 2 4 9 13 1 2 4 9 14 1 2 4 9 15 1 2 4 9 16 1 2 4 9 17 1 2 4 9 18 1 2 4 9 19 1 2 4 9 20 1 2 4 10 11 1 2 4 10 12 1 2 4 10 13 1 2 4 10 14 1 2 4 10 15 1 2 4 10 16 1 2 4 10 17 1 2 4 10 18 1 2 4 10 19 1 2 4 10 20 1 2 4 11 12 1 2 4 11 13 1 2 4 11 14 1 2 4 11 15 1 2 4 11 16 1 2 4 11 17 1 2 4 11 18 1 2 4 11 19 1 2 4 11 20 1 2 4 12 13 1 2 4 12 14 1 2 4 12 15 1 2 4 12 16 1 2 4 12 17 1 2 4 12 18 1 2 4 12 19 1 2 4 12 20 1 2 4 13 14 1 2 4 13 15 1 2 4 13 16 1 2 4 13 17 1 2 4 13 18 1 2 4 13 19 1 2 4 13 20 1 2 4 14 15 1 2 4 14 16 1 2 4 14 17 1 2 4 14 18 1 2 4 14 19 1 2 4 14 20 1 2 4 15 16 1 2 4 15 17 1 2 4 15 18 1 2 4 15 19 1 2 4 15 20 1 2 4 16 17 1 2 4 16 18 1 2 4 16 19 1 2 4 16 20 1 2 4 17 18 1 2 4 17 19 1 2 4 17 20 1 2 4 18 19 1 2 4 18 20 1 2 4 19 20 1 2 5 6 7 1 2 5 6 8 1 2 5 6 9 1 2 5 6 10 1 2 5 6 11 1 2 5 6 12 1 2 5 6 13 1 2 5 6 14 1 2 5 6 15 1 2 5 6 16 1 2 5 6 17 1 2 5 6 18 1 2 5 6 19 1 2 5 6 20 1 2 5 7 8 1 2 5 7 9 1 2 5 7 10 1 2 5 7 11 1 2 5 7 12 1 2 5 7 13 1 2 5 7 14 1 2 5 7 15 1 2 5 7 16 1 2 5 7 17 1 2 5 7 18 1 2 5 7 19 1 2 5 7 20 1 2 5 8 9 1 2 5 8 10 1 2 5 8 11 1 2 5 8 12 1 2 5 8 13 1 2 5 8 14 1 2 5 8 15 1 2 5 8 16 1 2 5 8 17 1 2 5 8 18 1 2 5 8 19 1 2 5 8 20 1 2 5 9 10 1 2 5 9 11 1 2 5 9 12 1 2 5 9 13 1 2 5 9 14 1 2 5 9 15 1 2 5 9 16 1 2 5 9 17 1 2 5 9 18 1 2 5 9 19 1 2 5 9 20 1 2 5 10 11 1 2 5 10 12 1 2 5 10 13 1 2 5 10 14 1 2 5 10 15 1 2 5 10 16 1 2 5 10 17 1 2 5 10 18 1 2 5 10 19 1 2 5 10 20 1 2 5 11 12 1 2 5 11 13 1 2 5 11 14 1 2 5 11 15 1 2 5 11 16 1 2 5 11 17 1 2 ...

9   Pass
assert(isequal(nextComb([11 13 17 18 20],20),[11 13 17 19 20]))

v = 1 2 3 4 5 1 2 3 4 6 1 2 3 4 7 1 2 3 4 8 1 2 3 4 9 1 2 3 4 10 1 2 3 4 11 1 2 3 4 12 1 2 3 4 13 1 2 3 4 14 1 2 3 4 15 1 2 3 4 16 1 2 3 4 17 1 2 3 4 18 1 2 3 4 19 1 2 3 4 20 1 2 3 5 6 1 2 3 5 7 1 2 3 5 8 1 2 3 5 9 1 2 3 5 10 1 2 3 5 11 1 2 3 5 12 1 2 3 5 13 1 2 3 5 14 1 2 3 5 15 1 2 3 5 16 1 2 3 5 17 1 2 3 5 18 1 2 3 5 19 1 2 3 5 20 1 2 3 6 7 1 2 3 6 8 1 2 3 6 9 1 2 3 6 10 1 2 3 6 11 1 2 3 6 12 1 2 3 6 13 1 2 3 6 14 1 2 3 6 15 1 2 3 6 16 1 2 3 6 17 1 2 3 6 18 1 2 3 6 19 1 2 3 6 20 1 2 3 7 8 1 2 3 7 9 1 2 3 7 10 1 2 3 7 11 1 2 3 7 12 1 2 3 7 13 1 2 3 7 14 1 2 3 7 15 1 2 3 7 16 1 2 3 7 17 1 2 3 7 18 1 2 3 7 19 1 2 3 7 20 1 2 3 8 9 1 2 3 8 10 1 2 3 8 11 1 2 3 8 12 1 2 3 8 13 1 2 3 8 14 1 2 3 8 15 1 2 3 8 16 1 2 3 8 17 1 2 3 8 18 1 2 3 8 19 1 2 3 8 20 1 2 3 9 10 1 2 3 9 11 1 2 3 9 12 1 2 3 9 13 1 2 3 9 14 1 2 3 9 15 1 2 3 9 16 1 2 3 9 17 1 2 3 9 18 1 2 3 9 19 1 2 3 9 20 1 2 3 10 11 1 2 3 10 12 1 2 3 10 13 1 2 3 10 14 1 2 3 10 15 1 2 3 10 16 1 2 3 10 17 1 2 3 10 18 1 2 3 10 19 1 2 3 10 20 1 2 3 11 12 1 2 3 11 13 1 2 3 11 14 1 2 3 11 15 1 2 3 11 16 1 2 3 11 17 1 2 3 11 18 1 2 3 11 19 1 2 3 11 20 1 2 3 12 13 1 2 3 12 14 1 2 3 12 15 1 2 3 12 16 1 2 3 12 17 1 2 3 12 18 1 2 3 12 19 1 2 3 12 20 1 2 3 13 14 1 2 3 13 15 1 2 3 13 16 1 2 3 13 17 1 2 3 13 18 1 2 3 13 19 1 2 3 13 20 1 2 3 14 15 1 2 3 14 16 1 2 3 14 17 1 2 3 14 18 1 2 3 14 19 1 2 3 14 20 1 2 3 15 16 1 2 3 15 17 1 2 3 15 18 1 2 3 15 19 1 2 3 15 20 1 2 3 16 17 1 2 3 16 18 1 2 3 16 19 1 2 3 16 20 1 2 3 17 18 1 2 3 17 19 1 2 3 17 20 1 2 3 18 19 1 2 3 18 20 1 2 3 19 20 1 2 4 5 6 1 2 4 5 7 1 2 4 5 8 1 2 4 5 9 1 2 4 5 10 1 2 4 5 11 1 2 4 5 12 1 2 4 5 13 1 2 4 5 14 1 2 4 5 15 1 2 4 5 16 1 2 4 5 17 1 2 4 5 18 1 2 4 5 19 1 2 4 5 20 1 2 4 6 7 1 2 4 6 8 1 2 4 6 9 1 2 4 6 10 1 2 4 6 11 1 2 4 6 12 1 2 4 6 13 1 2 4 6 14 1 2 4 6 15 1 2 4 6 16 1 2 4 6 17 1 2 4 6 18 1 2 4 6 19 1 2 4 6 20 1 2 4 7 8 1 2 4 7 9 1 2 4 7 10 1 2 4 7 11 1 2 4 7 12 1 2 4 7 13 1 2 4 7 14 1 2 4 7 15 1 2 4 7 16 1 2 4 7 17 1 2 4 7 18 1 2 4 7 19 1 2 4 7 20 1 2 4 8 9 1 2 4 8 10 1 2 4 8 11 1 2 4 8 12 1 2 4 8 13 1 2 4 8 14 1 2 4 8 15 1 2 4 8 16 1 2 4 8 17 1 2 4 8 18 1 2 4 8 19 1 2 4 8 20 1 2 4 9 10 1 2 4 9 11 1 2 4 9 12 1 2 4 9 13 1 2 4 9 14 1 2 4 9 15 1 2 4 9 16 1 2 4 9 17 1 2 4 9 18 1 2 4 9 19 1 2 4 9 20 1 2 4 10 11 1 2 4 10 12 1 2 4 10 13 1 2 4 10 14 1 2 4 10 15 1 2 4 10 16 1 2 4 10 17 1 2 4 10 18 1 2 4 10 19 1 2 4 10 20 1 2 4 11 12 1 2 4 11 13 1 2 4 11 14 1 2 4 11 15 1 2 4 11 16 1 2 4 11 17 1 2 4 11 18 1 2 4 11 19 1 2 4 11 20 1 2 4 12 13 1 2 4 12 14 1 2 4 12 15 1 2 4 12 16 1 2 4 12 17 1 2 4 12 18 1 2 4 12 19 1 2 4 12 20 1 2 4 13 14 1 2 4 13 15 1 2 4 13 16 1 2 4 13 17 1 2 4 13 18 1 2 4 13 19 1 2 4 13 20 1 2 4 14 15 1 2 4 14 16 1 2 4 14 17 1 2 4 14 18 1 2 4 14 19 1 2 4 14 20 1 2 4 15 16 1 2 4 15 17 1 2 4 15 18 1 2 4 15 19 1 2 4 15 20 1 2 4 16 17 1 2 4 16 18 1 2 4 16 19 1 2 4 16 20 1 2 4 17 18 1 2 4 17 19 1 2 4 17 20 1 2 4 18 19 1 2 4 18 20 1 2 4 19 20 1 2 5 6 7 1 2 5 6 8 1 2 5 6 9 1 2 5 6 10 1 2 5 6 11 1 2 5 6 12 1 2 5 6 13 1 2 5 6 14 1 2 5 6 15 1 2 5 6 16 1 2 5 6 17 1 2 5 6 18 1 2 5 6 19 1 2 5 6 20 1 2 5 7 8 1 2 5 7 9 1 2 5 7 10 1 2 5 7 11 1 2 5 7 12 1 2 5 7 13 1 2 5 7 14 1 2 5 7 15 1 2 5 7 16 1 2 5 7 17 1 2 5 7 18 1 2 5 7 19 1 2 5 7 20 1 2 5 8 9 1 2 5 8 10 1 2 5 8 11 1 2 5 8 12 1 2 5 8 13 1 2 5 8 14 1 2 5 8 15 1 2 5 8 16 1 2 5 8 17 1 2 5 8 18 1 2 5 8 19 1 2 5 8 20 1 2 5 9 10 1 2 5 9 11 1 2 5 9 12 1 2 5 9 13 1 2 5 9 14 1 2 5 9 15 1 2 5 9 16 1 2 5 9 17 1 2 5 9 18 1 2 5 9 19 1 2 5 9 20 1 2 5 10 11 1 2 5 10 12 1 2 5 10 13 1 2 5 10 14 1 2 5 10 15 1 2 5 10 16 1 2 5 10 17 1 2 5 10 18 1 2 5 10 19 1 2 5 10 20 1 2 5 11 12 1 2 5 11 13 1 2 5 11 14 1 2 5 11 15 1 2 5 11 16 1 2 5 11 17 1 2 ...

10   Pass
assert(isequal(nextComb([7 8 13 17 19 20],20),[7 8 13 18 19 20]))

v = 1 2 3 4 5 6 1 2 3 4 5 7 1 2 3 4 5 8 1 2 3 4 5 9 1 2 3 4 5 10 1 2 3 4 5 11 1 2 3 4 5 12 1 2 3 4 5 13 1 2 3 4 5 14 1 2 3 4 5 15 1 2 3 4 5 16 1 2 3 4 5 17 1 2 3 4 5 18 1 2 3 4 5 19 1 2 3 4 5 20 1 2 3 4 6 7 1 2 3 4 6 8 1 2 3 4 6 9 1 2 3 4 6 10 1 2 3 4 6 11 1 2 3 4 6 12 1 2 3 4 6 13 1 2 3 4 6 14 1 2 3 4 6 15 1 2 3 4 6 16 1 2 3 4 6 17 1 2 3 4 6 18 1 2 3 4 6 19 1 2 3 4 6 20 1 2 3 4 7 8 1 2 3 4 7 9 1 2 3 4 7 10 1 2 3 4 7 11 1 2 3 4 7 12 1 2 3 4 7 13 1 2 3 4 7 14 1 2 3 4 7 15 1 2 3 4 7 16 1 2 3 4 7 17 1 2 3 4 7 18 1 2 3 4 7 19 1 2 3 4 7 20 1 2 3 4 8 9 1 2 3 4 8 10 1 2 3 4 8 11 1 2 3 4 8 12 1 2 3 4 8 13 1 2 3 4 8 14 1 2 3 4 8 15 1 2 3 4 8 16 1 2 3 4 8 17 1 2 3 4 8 18 1 2 3 4 8 19 1 2 3 4 8 20 1 2 3 4 9 10 1 2 3 4 9 11 1 2 3 4 9 12 1 2 3 4 9 13 1 2 3 4 9 14 1 2 3 4 9 15 1 2 3 4 9 16 1 2 3 4 9 17 1 2 3 4 9 18 1 2 3 4 9 19 1 2 3 4 9 20 1 2 3 4 10 11 1 2 3 4 10 12 1 2 3 4 10 13 1 2 3 4 10 14 1 2 3 4 10 15 1 2 3 4 10 16 1 2 3 4 10 17 1 2 3 4 10 18 1 2 3 4 10 19 1 2 3 4 10 20 1 2 3 4 11 12 1 2 3 4 11 13 1 2 3 4 11 14 1 2 3 4 11 15 1 2 3 4 11 16 1 2 3 4 11 17 1 2 3 4 11 18 1 2 3 4 11 19 1 2 3 4 11 20 1 2 3 4 12 13 1 2 3 4 12 14 1 2 3 4 12 15 1 2 3 4 12 16 1 2 3 4 12 17 1 2 3 4 12 18 1 2 3 4 12 19 1 2 3 4 12 20 1 2 3 4 13 14 1 2 3 4 13 15 1 2 3 4 13 16 1 2 3 4 13 17 1 2 3 4 13 18 1 2 3 4 13 19 1 2 3 4 13 20 1 2 3 4 14 15 1 2 3 4 14 16 1 2 3 4 14 17 1 2 3 4 14 18 1 2 3 4 14 19 1 2 3 4 14 20 1 2 3 4 15 16 1 2 3 4 15 17 1 2 3 4 15 18 1 2 3 4 15 19 1 2 3 4 15 20 1 2 3 4 16 17 1 2 3 4 16 18 1 2 3 4 16 19 1 2 3 4 16 20 1 2 3 4 17 18 1 2 3 4 17 19 1 2 3 4 17 20 1 2 3 4 18 19 1 2 3 4 18 20 1 2 3 4 19 20 1 2 3 5 6 7 1 2 3 5 6 8 1 2 3 5 6 9 1 2 3 5 6 10 1 2 3 5 6 11 1 2 3 5 6 12 1 2 3 5 6 13 1 2 3 5 6 14 1 2 3 5 6 15 1 2 3 5 6 16 1 2 3 5 6 17 1 2 3 5 6 18 1 2 3 5 6 19 1 2 3 5 6 20 1 2 3 5 7 8 1 2 3 5 7 9 1 2 3 5 7 10 1 2 3 5 7 11 1 2 3 5 7 12 1 2 3 5 7 13 1 2 3 5 7 14 1 2 3 5 7 15 1 2 3 5 7 16 1 2 3 5 7 17 1 2 3 5 7 18 1 2 3 5 7 19 1 2 3 5 7 20 1 2 3 5 8 9 1 2 3 5 8 10 1 2 3 5 8 11 1 2 3 5 8 12 1 2 3 5 8 13 1 2 3 5 8 14 1 2 3 5 8 15 1 2 3 5 8 16 1 2 3 5 8 17 1 2 3 5 8 18 1 2 3 5 8 19 1 2 3 5 8 20 1 2 3 5 9 10 1 2 3 5 9 11 1 2 3 5 9 12 1 2 3 5 9 13 1 2 3 5 9 14 1 2 3 5 9 15 1 2 3 5 9 16 1 2 3 5 9 17 1 2 3 5 9 18 1 2 3 5 9 19 1 2 3 5 9 20 1 2 3 5 10 11 1 2 3 5 10 12 1 2 3 5 10 13 1 2 3 5 10 14 1 2 3 5 10 15 1 2 3 5 10 16 1 2 3 5 10 17 1 2 3 5 10 18 1 2 3 5 10 19 1 2 3 5 10 20 1 2 3 5 11 12 1 2 3 5 11 13 1 2 3 5 11 14 1 2 3 5 11 15 1 2 3 5 11 16 1 2 3 5 11 17 1 2 3 5 11 18 1 2 3 5 11 19 1 2 3 5 11 20 1 2 3 5 12 13 1 2 3 5 12 14 1 2 3 5 12 15 1 2 3 5 12 16 1 2 3 5 12 17 1 2 3 5 12 18 1 2 3 5 12 19 1 2 3 5 12 20 1 2 3 5 13 14 1 2 3 5 13 15 1 2 3 5 13 16 1 2 3 5 13 17 1 2 3 5 13 18 1 2 3 5 13 19 1 2 3 5 13 20 1 2 3 5 14 15 1 2 3 5 14 16 1 2 3 5 14 17 1 2 3 5 14 18 1 2 3 5 14 19 1 2 3 5 14 20 1 2 3 5 15 16 1 2 3 5 15 17 1 2 3 5 15 18 1 2 3 5 15 19 1 2 3 5 15 20 1 2 3 5 16 17 1 2 3 5 16 18 1 2 3 5 16 19 1 2 3 5 16 20 1 2 3 5 17 18 1 2 3 5 17 19 1 2 3 5 17 20 1 2 3 5 18 19 1 2 3 5 18 20 1 2 3 5 19 20 1 2 3 6 7 8 1 2 3 6 7 9 1 2 3 6 7 10 1 2 3 6 7 11 1 2 3 6 7 12 1 2 3 6 7 13 1 2 3 6 7 14 1 2 3 6 7 15 1 2 3 6 7 16 1 2 3 6 7 17 1 2 3 6 7 18 1 2 3 6 7 19 1 2 3 6 7 20 1 2 3 6 8 9 1 2 3 6 8 10 1 2 3 6 8 11 1 2 3 6 8 12 1 2 3 6 8 13 1 2 3 6 8 14 1 2 3 6 8 15 1 2 3 6 8 16 1 2 3 6 8 17 1 2 3 6 8 18 1 2 3 6 8 19 1 2 3 6 8 20 1 2 3 6 9 10 1 2 3 6 9 11 1 2 3 6 9 12 1 2 3 6 9 13 1 2 3 6 9 14 1 2 3 6 9 15 1 2 3 6 9 16 1 2 3 6 9 17 1 2 3 6 9 18 1 2 3 6 9 19 1 2 3 6 9 20 1 2 3 6 10 11 1 2 3 6 10 12 1 2 3 6 10 13 1 2 3 6 10 14 1 2 3 6 10 15 1 2 3 6 10 16 1 2 3 6 10 17 1 2 3 6 10 18 1 2 3 6 10 19 ...

11   Pass
assert(isequal(nextComb([10 11 17 18 19 20],20),[10 12 13 14 15 16]))

v = 1 2 3 4 5 6 1 2 3 4 5 7 1 2 3 4 5 8 1 2 3 4 5 9 1 2 3 4 5 10 1 2 3 4 5 11 1 2 3 4 5 12 1 2 3 4 5 13 1 2 3 4 5 14 1 2 3 4 5 15 1 2 3 4 5 16 1 2 3 4 5 17 1 2 3 4 5 18 1 2 3 4 5 19 1 2 3 4 5 20 1 2 3 4 6 7 1 2 3 4 6 8 1 2 3 4 6 9 1 2 3 4 6 10 1 2 3 4 6 11 1 2 3 4 6 12 1 2 3 4 6 13 1 2 3 4 6 14 1 2 3 4 6 15 1 2 3 4 6 16 1 2 3 4 6 17 1 2 3 4 6 18 1 2 3 4 6 19 1 2 3 4 6 20 1 2 3 4 7 8 1 2 3 4 7 9 1 2 3 4 7 10 1 2 3 4 7 11 1 2 3 4 7 12 1 2 3 4 7 13 1 2 3 4 7 14 1 2 3 4 7 15 1 2 3 4 7 16 1 2 3 4 7 17 1 2 3 4 7 18 1 2 3 4 7 19 1 2 3 4 7 20 1 2 3 4 8 9 1 2 3 4 8 10 1 2 3 4 8 11 1 2 3 4 8 12 1 2 3 4 8 13 1 2 3 4 8 14 1 2 3 4 8 15 1 2 3 4 8 16 1 2 3 4 8 17 1 2 3 4 8 18 1 2 3 4 8 19 1 2 3 4 8 20 1 2 3 4 9 10 1 2 3 4 9 11 1 2 3 4 9 12 1 2 3 4 9 13 1 2 3 4 9 14 1 2 3 4 9 15 1 2 3 4 9 16 1 2 3 4 9 17 1 2 3 4 9 18 1 2 3 4 9 19 1 2 3 4 9 20 1 2 3 4 10 11 1 2 3 4 10 12 1 2 3 4 10 13 1 2 3 4 10 14 1 2 3 4 10 15 1 2 3 4 10 16 1 2 3 4 10 17 1 2 3 4 10 18 1 2 3 4 10 19 1 2 3 4 10 20 1 2 3 4 11 12 1 2 3 4 11 13 1 2 3 4 11 14 1 2 3 4 11 15 1 2 3 4 11 16 1 2 3 4 11 17 1 2 3 4 11 18 1 2 3 4 11 19 1 2 3 4 11 20 1 2 3 4 12 13 1 2 3 4 12 14 1 2 3 4 12 15 1 2 3 4 12 16 1 2 3 4 12 17 1 2 3 4 12 18 1 2 3 4 12 19 1 2 3 4 12 20 1 2 3 4 13 14 1 2 3 4 13 15 1 2 3 4 13 16 1 2 3 4 13 17 1 2 3 4 13 18 1 2 3 4 13 19 1 2 3 4 13 20 1 2 3 4 14 15 1 2 3 4 14 16 1 2 3 4 14 17 1 2 3 4 14 18 1 2 3 4 14 19 1 2 3 4 14 20 1 2 3 4 15 16 1 2 3 4 15 17 1 2 3 4 15 18 1 2 3 4 15 19 1 2 3 4 15 20 1 2 3 4 16 17 1 2 3 4 16 18 1 2 3 4 16 19 1 2 3 4 16 20 1 2 3 4 17 18 1 2 3 4 17 19 1 2 3 4 17 20 1 2 3 4 18 19 1 2 3 4 18 20 1 2 3 4 19 20 1 2 3 5 6 7 1 2 3 5 6 8 1 2 3 5 6 9 1 2 3 5 6 10 1 2 3 5 6 11 1 2 3 5 6 12 1 2 3 5 6 13 1 2 3 5 6 14 1 2 3 5 6 15 1 2 3 5 6 16 1 2 3 5 6 17 1 2 3 5 6 18 1 2 3 5 6 19 1 2 3 5 6 20 1 2 3 5 7 8 1 2 3 5 7 9 1 2 3 5 7 10 1 2 3 5 7 11 1 2 3 5 7 12 1 2 3 5 7 13 1 2 3 5 7 14 1 2 3 5 7 15 1 2 3 5 7 16 1 2 3 5 7 17 1 2 3 5 7 18 1 2 3 5 7 19 1 2 3 5 7 20 1 2 3 5 8 9 1 2 3 5 8 10 1 2 3 5 8 11 1 2 3 5 8 12 1 2 3 5 8 13 1 2 3 5 8 14 1 2 3 5 8 15 1 2 3 5 8 16 1 2 3 5 8 17 1 2 3 5 8 18 1 2 3 5 8 19 1 2 3 5 8 20 1 2 3 5 9 10 1 2 3 5 9 11 1 2 3 5 9 12 1 2 3 5 9 13 1 2 3 5 9 14 1 2 3 5 9 15 1 2 3 5 9 16 1 2 3 5 9 17 1 2 3 5 9 18 1 2 3 5 9 19 1 2 3 5 9 20 1 2 3 5 10 11 1 2 3 5 10 12 1 2 3 5 10 13 1 2 3 5 10 14 1 2 3 5 10 15 1 2 3 5 10 16 1 2 3 5 10 17 1 2 3 5 10 18 1 2 3 5 10 19 1 2 3 5 10 20 1 2 3 5 11 12 1 2 3 5 11 13 1 2 3 5 11 14 1 2 3 5 11 15 1 2 3 5 11 16 1 2 3 5 11 17 1 2 3 5 11 18 1 2 3 5 11 19 1 2 3 5 11 20 1 2 3 5 12 13 1 2 3 5 12 14 1 2 3 5 12 15 1 2 3 5 12 16 1 2 3 5 12 17 1 2 3 5 12 18 1 2 3 5 12 19 1 2 3 5 12 20 1 2 3 5 13 14 1 2 3 5 13 15 1 2 3 5 13 16 1 2 3 5 13 17 1 2 3 5 13 18 1 2 3 5 13 19 1 2 3 5 13 20 1 2 3 5 14 15 1 2 3 5 14 16 1 2 3 5 14 17 1 2 3 5 14 18 1 2 3 5 14 19 1 2 3 5 14 20 1 2 3 5 15 16 1 2 3 5 15 17 1 2 3 5 15 18 1 2 3 5 15 19 1 2 3 5 15 20 1 2 3 5 16 17 1 2 3 5 16 18 1 2 3 5 16 19 1 2 3 5 16 20 1 2 3 5 17 18 1 2 3 5 17 19 1 2 3 5 17 20 1 2 3 5 18 19 1 2 3 5 18 20 1 2 3 5 19 20 1 2 3 6 7 8 1 2 3 6 7 9 1 2 3 6 7 10 1 2 3 6 7 11 1 2 3 6 7 12 1 2 3 6 7 13 1 2 3 6 7 14 1 2 3 6 7 15 1 2 3 6 7 16 1 2 3 6 7 17 1 2 3 6 7 18 1 2 3 6 7 19 1 2 3 6 7 20 1 2 3 6 8 9 1 2 3 6 8 10 1 2 3 6 8 11 1 2 3 6 8 12 1 2 3 6 8 13 1 2 3 6 8 14 1 2 3 6 8 15 1 2 3 6 8 16 1 2 3 6 8 17 1 2 3 6 8 18 1 2 3 6 8 19 1 2 3 6 8 20 1 2 3 6 9 10 1 2 3 6 9 11 1 2 3 6 9 12 1 2 3 6 9 13 1 2 3 6 9 14 1 2 3 6 9 15 1 2 3 6 9 16 1 2 3 6 9 17 1 2 3 6 9 18 1 2 3 6 9 19 1 2 3 6 9 20 1 2 3 6 10 11 1 2 3 6 10 12 1 2 3 6 10 13 1 2 3 6 10 14 1 2 3 6 10 15 1 2 3 6 10 16 1 2 3 6 10 17 1 2 3 6 10 18 1 2 3 6 10 19 ...

12   Pass
assert(isequal(nextComb([12 16 17 18 19 20],20),[13 14 15 16 17 18]))

v = 1 2 3 4 5 6 1 2 3 4 5 7 1 2 3 4 5 8 1 2 3 4 5 9 1 2 3 4 5 10 1 2 3 4 5 11 1 2 3 4 5 12 1 2 3 4 5 13 1 2 3 4 5 14 1 2 3 4 5 15 1 2 3 4 5 16 1 2 3 4 5 17 1 2 3 4 5 18 1 2 3 4 5 19 1 2 3 4 5 20 1 2 3 4 6 7 1 2 3 4 6 8 1 2 3 4 6 9 1 2 3 4 6 10 1 2 3 4 6 11 1 2 3 4 6 12 1 2 3 4 6 13 1 2 3 4 6 14 1 2 3 4 6 15 1 2 3 4 6 16 1 2 3 4 6 17 1 2 3 4 6 18 1 2 3 4 6 19 1 2 3 4 6 20 1 2 3 4 7 8 1 2 3 4 7 9 1 2 3 4 7 10 1 2 3 4 7 11 1 2 3 4 7 12 1 2 3 4 7 13 1 2 3 4 7 14 1 2 3 4 7 15 1 2 3 4 7 16 1 2 3 4 7 17 1 2 3 4 7 18 1 2 3 4 7 19 1 2 3 4 7 20 1 2 3 4 8 9 1 2 3 4 8 10 1 2 3 4 8 11 1 2 3 4 8 12 1 2 3 4 8 13 1 2 3 4 8 14 1 2 3 4 8 15 1 2 3 4 8 16 1 2 3 4 8 17 1 2 3 4 8 18 1 2 3 4 8 19 1 2 3 4 8 20 1 2 3 4 9 10 1 2 3 4 9 11 1 2 3 4 9 12 1 2 3 4 9 13 1 2 3 4 9 14 1 2 3 4 9 15 1 2 3 4 9 16 1 2 3 4 9 17 1 2 3 4 9 18 1 2 3 4 9 19 1 2 3 4 9 20 1 2 3 4 10 11 1 2 3 4 10 12 1 2 3 4 10 13 1 2 3 4 10 14 1 2 3 4 10 15 1 2 3 4 10 16 1 2 3 4 10 17 1 2 3 4 10 18 1 2 3 4 10 19 1 2 3 4 10 20 1 2 3 4 11 12 1 2 3 4 11 13 1 2 3 4 11 14 1 2 3 4 11 15 1 2 3 4 11 16 1 2 3 4 11 17 1 2 3 4 11 18 1 2 3 4 11 19 1 2 3 4 11 20 1 2 3 4 12 13 1 2 3 4 12 14 1 2 3 4 12 15 1 2 3 4 12 16 1 2 3 4 12 17 1 2 3 4 12 18 1 2 3 4 12 19 1 2 3 4 12 20 1 2 3 4 13 14 1 2 3 4 13 15 1 2 3 4 13 16 1 2 3 4 13 17 1 2 3 4 13 18 1 2 3 4 13 19 1 2 3 4 13 20 1 2 3 4 14 15 1 2 3 4 14 16 1 2 3 4 14 17 1 2 3 4 14 18 1 2 3 4 14 19 1 2 3 4 14 20 1 2 3 4 15 16 1 2 3 4 15 17 1 2 3 4 15 18 1 2 3 4 15 19 1 2 3 4 15 20 1 2 3 4 16 17 1 2 3 4 16 18 1 2 3 4 16 19 1 2 3 4 16 20 1 2 3 4 17 18 1 2 3 4 17 19 1 2 3 4 17 20 1 2 3 4 18 19 1 2 3 4 18 20 1 2 3 4 19 20 1 2 3 5 6 7 1 2 3 5 6 8 1 2 3 5 6 9 1 2 3 5 6 10 1 2 3 5 6 11 1 2 3 5 6 12 1 2 3 5 6 13 1 2 3 5 6 14 1 2 3 5 6 15 1 2 3 5 6 16 1 2 3 5 6 17 1 2 3 5 6 18 1 2 3 5 6 19 1 2 3 5 6 20 1 2 3 5 7 8 1 2 3 5 7 9 1 2 3 5 7 10 1 2 3 5 7 11 1 2 3 5 7 12 1 2 3 5 7 13 1 2 3 5 7 14 1 2 3 5 7 15 1 2 3 5 7 16 1 2 3 5 7 17 1 2 3 5 7 18 1 2 3 5 7 19 1 2 3 5 7 20 1 2 3 5 8 9 1 2 3 5 8 10 1 2 3 5 8 11 1 2 3 5 8 12 1 2 3 5 8 13 1 2 3 5 8 14 1 2 3 5 8 15 1 2 3 5 8 16 1 2 3 5 8 17 1 2 3 5 8 18 1 2 3 5 8 19 1 2 3 5 8 20 1 2 3 5 9 10 1 2 3 5 9 11 1 2 3 5 9 12 1 2 3 5 9 13 1 2 3 5 9 14 1 2 3 5 9 15 1 2 3 5 9 16 1 2 3 5 9 17 1 2 3 5 9 18 1 2 3 5 9 19 1 2 3 5 9 20 1 2 3 5 10 11 1 2 3 5 10 12 1 2 3 5 10 13 1 2 3 5 10 14 1 2 3 5 10 15 1 2 3 5 10 16 1 2 3 5 10 17 1 2 3 5 10 18 1 2 3 5 10 19 1 2 3 5 10 20 1 2 3 5 11 12 1 2 3 5 11 13 1 2 3 5 11 14 1 2 3 5 11 15 1 2 3 5 11 16 1 2 3 5 11 17 1 2 3 5 11 18 1 2 3 5 11 19 1 2 3 5 11 20 1 2 3 5 12 13 1 2 3 5 12 14 1 2 3 5 12 15 1 2 3 5 12 16 1 2 3 5 12 17 1 2 3 5 12 18 1 2 3 5 12 19 1 2 3 5 12 20 1 2 3 5 13 14 1 2 3 5 13 15 1 2 3 5 13 16 1 2 3 5 13 17 1 2 3 5 13 18 1 2 3 5 13 19 1 2 3 5 13 20 1 2 3 5 14 15 1 2 3 5 14 16 1 2 3 5 14 17 1 2 3 5 14 18 1 2 3 5 14 19 1 2 3 5 14 20 1 2 3 5 15 16 1 2 3 5 15 17 1 2 3 5 15 18 1 2 3 5 15 19 1 2 3 5 15 20 1 2 3 5 16 17 1 2 3 5 16 18 1 2 3 5 16 19 1 2 3 5 16 20 1 2 3 5 17 18 1 2 3 5 17 19 1 2 3 5 17 20 1 2 3 5 18 19 1 2 3 5 18 20 1 2 3 5 19 20 1 2 3 6 7 8 1 2 3 6 7 9 1 2 3 6 7 10 1 2 3 6 7 11 1 2 3 6 7 12 1 2 3 6 7 13 1 2 3 6 7 14 1 2 3 6 7 15 1 2 3 6 7 16 1 2 3 6 7 17 1 2 3 6 7 18 1 2 3 6 7 19 1 2 3 6 7 20 1 2 3 6 8 9 1 2 3 6 8 10 1 2 3 6 8 11 1 2 3 6 8 12 1 2 3 6 8 13 1 2 3 6 8 14 1 2 3 6 8 15 1 2 3 6 8 16 1 2 3 6 8 17 1 2 3 6 8 18 1 2 3 6 8 19 1 2 3 6 8 20 1 2 3 6 9 10 1 2 3 6 9 11 1 2 3 6 9 12 1 2 3 6 9 13 1 2 3 6 9 14 1 2 3 6 9 15 1 2 3 6 9 16 1 2 3 6 9 17 1 2 3 6 9 18 1 2 3 6 9 19 1 2 3 6 9 20 1 2 3 6 10 11 1 2 3 6 10 12 1 2 3 6 10 13 1 2 3 6 10 14 1 2 3 6 10 15 1 2 3 6 10 16 1 2 3 6 10 17 1 2 3 6 10 18 1 2 3 6 10 19 ...

13   Fail
assert(isequal(nextComb([1:6 9 14 19 20 21 23 26 29 30],30),[1:6 9 14 19 20 21 23 27 28 29]))

Error using zeros Requested 155117520x15 (17.3GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information. Error in nchoosek>combs (line 164) P = zeros(total, k, 'like', v); Error in nchoosek (line 123) c = combs(v,k); Error in nextComb (line 6) v=nchoosek(a,len) Error in Test13 (line 1) assert(isequal(nextComb([1:6 9 14 19 20 21 23 26 29 30],30),[1:6 9 14 19 20 21 23 27 28 29]))

14   Fail
assert(isequal(nextComb([1:5 7 11 13 15 18 19 21 22 27 29],30),[1:5 7 11 13 15 18 19 21 22 27 30]))

Error using zeros Requested 155117520x15 (17.3GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information. Error in nchoosek>combs (line 164) P = zeros(total, k, 'like', v); Error in nchoosek (line 123) c = combs(v,k); Error in nextComb (line 6) v=nchoosek(a,len) Error in Test14 (line 1) assert(isequal(nextComb([1:5 7 11 13 15 18 19 21 22 27 29],30),[1:5 7 11 13 15 18 19 21 22 27 30]))

15   Fail
assert(isequal(nextComb([1:4 6 10 13 14 15 18 19 20 23 24 30],30),[1:4 6 10 13 14 15 18 19 20 23 25 26]))

Error using zeros Requested 155117520x15 (17.3GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information. Error in nchoosek>combs (line 164) P = zeros(total, k, 'like', v); Error in nchoosek (line 123) c = combs(v,k); Error in nextComb (line 6) v=nchoosek(a,len) Error in Test15 (line 1) assert(isequal(nextComb([1:4 6 10 13 14 15 18 19 20 23 24 30],30),[1:4 6 10 13 14 15 18 19 20 23 25 26]))

16   Fail
assert(isequal(nextComb([1:17 19 23 27 33 40 42 48 50],50),[1:17 19 23 27 33 40 42 49 50]))

Error using zeros Maximum variable size allowed by the program is exceeded. Error in nchoosek>combs (line 164) P = zeros(total, k, 'like', v); Error in nchoosek (line 123) c = combs(v,k); Error in nextComb (line 6) v=nchoosek(a,len) Error in Test16 (line 1) assert(isequal(nextComb([1:17 19 23 27 33 40 42 48 50],50),[1:17 19 23 27 33 40 42 49 50]))

17   Fail
assert(isequal(nextComb([1:17 22 24 27 30 35 36 38 44],50),[1:17 22 24 27 30 35 36 38 45]))

Error using zeros Maximum variable size allowed by the program is exceeded. Error in nchoosek>combs (line 164) P = zeros(total, k, 'like', v); Error in nchoosek (line 123) c = combs(v,k); Error in nextComb (line 6) v=nchoosek(a,len) Error in Test17 (line 1) assert(isequal(nextComb([1:17 22 24 27 30 35 36 38 44],50),[1:17 22 24 27 30 35 36 38 45]))

18   Fail
assert(isequal(nextComb([1:16 18 19 22 23 27 44 45 46 48],50),[1:16 18 19 22 23 27 44 45 46 49]))

Error using zeros Maximum variable size allowed by the program is exceeded. Error in nchoosek>combs (line 164) P = zeros(total, k, 'like', v); Error in nchoosek (line 123) c = combs(v,k); Error in nextComb (line 6) v=nchoosek(a,len) Error in Test18 (line 1) assert(isequal(nextComb([1:16 18 19 22 23 27 44 45 46 48],50),[1:16 18 19 22 23 27 44 45 46 49]))

19   Fail
assert(isequal(nextComb([1:13 15 23 25 26 28 30 32 38 39 42 46 50],50),[1:13 15 23 25 26 28 30 32 38 39 42 47 48]))

Error using zeros Maximum variable size allowed by the program is exceeded. Error in nchoosek>combs (line 164) P = zeros(total, k, 'like', v); Error in nchoosek (line 123) c = combs(v,k); Error in nextComb (line 6) v=nchoosek(a,len) Error in Test19 (line 1) assert(isequal(nextComb([1:13 15 23 25 26 28 30 32 38 39 42 46 50],50),[1:13 15 23 25 26 28 30 32 38 39 42 47 48]))

20   Pass
assert(isequal(nextComb(1,9),2))

v = 1 2 3 4 5 6 7 8 9 check = logical 1

21   Pass
assert(isequal(nextComb(2,9),3))

v = 1 2 3 4 5 6 7 8 9 check = logical 0 check = logical 1

22   Pass
assert(isequal(nextComb(3,9),4))

v = 1 2 3 4 5 6 7 8 9 check = logical 0 check = logical 0 check = logical 1

23   Pass
assert(isequal(nextComb(4,9),5))

v = 1 2 3 4 5 6 7 8 9 check = logical 0 check = logical 0 check = logical 0 check = logical 1

24   Pass
assert(isequal(nextComb(5,9),6))

v = 1 2 3 4 5 6 7 8 9 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 1

25   Pass
assert(isequal(nextComb(6,9),7))

v = 1 2 3 4 5 6 7 8 9 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 1

26   Pass
assert(isequal(nextComb(7,9),8))

v = 1 2 3 4 5 6 7 8 9 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 1

27   Pass
assert(isequal(nextComb(8,9),9))

v = 1 2 3 4 5 6 7 8 9 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 1

28   Pass
assert(isequal(nextComb(9,9),9))

v = 1 2 3 4 5 6 7 8 9 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 0 check = logical 1