Cody

# Problem 1722. Find the next prime number

Solution 1943523

Submitted on 20 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
n = 1; out = 2; assert(isequal(nextprimenum(n),out))

Unrecognized function or variable 'y'. Error in nextprimenum (line 3) y(find(prime(y),1)); Error in Test1 (line 3) assert(isequal(nextprimenum(n),out))

2   Fail
n = 7; out = 11; assert(isequal(nextprimenum(n),out))

Unrecognized function or variable 'y'. Error in nextprimenum (line 3) y(find(prime(y),1)); Error in Test2 (line 3) assert(isequal(nextprimenum(n),out))

3   Fail
n = [1 2 3 4 5 6 7 8 9]; out = [2 3 5 5 7 7 11 11 11]; assert(isequal(nextprimenum(n),out))

Matrix dimensions must agree. Error in nextprimenum (line 2) abs(n + str2num('0:100;0:-1:-100')); Error in Test3 (line 3) assert(isequal(nextprimenum(n),out))

4   Fail
n = [71 25 63 47 65 36 47 58 69]; out = [73 29 67 53 67 37 53 59 71]; assert(isequal(nextprimenum(n),out))

Matrix dimensions must agree. Error in nextprimenum (line 2) abs(n + str2num('0:100;0:-1:-100')); Error in Test4 (line 3) assert(isequal(nextprimenum(n),out))

5   Fail
n = [171 255 636 487 675 369 477 538 969]; out = [173 257 641 491 677 373 479 541 971]; assert(isequal(nextprimenum(n),out))

Matrix dimensions must agree. Error in nextprimenum (line 2) abs(n + str2num('0:100;0:-1:-100')); Error in Test5 (line 3) assert(isequal(nextprimenum(n),out))

6   Fail
n = [172541 255564 632436 4564587 6778675 334469 475647 575638 96879]; out = [172553 255571 632447 4564589 6778691 334487 475649 575647 96893]; assert(isequal(nextprimenum(n),out))

Matrix dimensions must agree. Error in nextprimenum (line 2) abs(n + str2num('0:100;0:-1:-100')); Error in Test6 (line 3) assert(isequal(nextprimenum(n),out))