Cody

# Problem 1722. Find the next prime number

Solution 1873170

Submitted on 13 Jul 2019 by Nikolaos Nikolaou
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
n = 1; out = 2; assert(isequal(nextprimenum(n),out))

y = 2 y = 2

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

y = 11 y = 11

3   Pass
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))

y = 2 y = 2 3 y = 2 3 5 y = 2 3 5 5 y = 2 3 5 5 7 y = 2 3 5 5 7 7 y = 2 3 5 5 7 7 11 y = 2 3 5 5 7 7 11 11 y = 2 3 5 5 7 7 11 11 11 y = 2 3 5 5 7 7 11 11 11

4   Pass
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))

y = 73 y = 73 29 y = 73 29 67 y = 73 29 67 53 y = 73 29 67 53 67 y = 73 29 67 53 67 37 y = 73 29 67 53 67 37 53 y = 73 29 67 53 67 37 53 59 y = 73 29 67 53 67 37 53 59 71 y = 73 29 67 53 67 37 53 59 71

5   Pass
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))

y = 173 y = 173 257 y = 173 257 641 y = 173 257 641 491 y = 173 257 641 491 677 y = 173 257 641 491 677 373 y = 173 257 641 491 677 373 479 y = 173 257 641 491 677 373 479 541 y = 173 257 641 491 677 373 479 541 971 y = 173 257 641 491 677 373 479 541 971

6   Pass
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))

y = 172553 y = 172553 255571 y = 172553 255571 632447 y = 172553 255571 632447 4564589 y = 172553 255571 632447 4564589 6778691 y = 172553 255571 632447 4564589 6778691 334487 y = 172553 255571 632447 4564589 6778691 334487 475649 y = 172553 255571 632447 4564589 6778691 334487 475649 575647 y = 172553 255571 632447 4564589 6778691 334487 475649 575647 96893 y = 172553 255571 632447 4564589 6778691 334487 475649 575647 96893