Cody

Solution 1757080

Submitted on 21 Mar 2019 by Jason Casey
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
x = 0; y_correct = 2; assert(isequal(nearestprime(x),y_correct))

z = 1 z = 2

2   Pass
x = 5; y_correct = 5; assert(isequal(nearestprime(x),y_correct))

3   Pass
x = 100; y_correct = 101; assert(isequal(nearestprime(x),y_correct))

z = 101

4   Pass
x = 500; y_correct = 499; assert(isequal(nearestprime(x),y_correct))

z = 501 z = 502 z = 503

5   Pass
x = 911; y_correct = 911; assert(isequal(nearestprime(x),y_correct))

6   Pass
x = 2500; y_correct = 2503; assert(isequal(nearestprime(x),y_correct))

z = 2501 z = 2502 z = 2503

7   Pass
x = 8000; y_correct = 7993; assert(isequal(nearestprime(x),y_correct))

z = 8001 z = 8002 z = 8003 z = 8004 z = 8005 z = 8006 z = 8007 z = 8008 z = 8009

8   Pass
x = 100000; y_correct = 100003; assert(isequal(nearestprime(x),y_correct))

z = 100001 z = 100002 z = 100003

9   Pass
x = 1300000; y_correct = 1299989; assert(isequal(nearestprime(x),y_correct))

z = 1300001 z = 1300002 z = 1300003 z = 1300004 z = 1300005 z = 1300006 z = 1300007 z = 1300008 z = 1300009 z = 1300010 z = 1300011 z = 1300012 z = 1300013 z = 1300014 z = 1300015 z = 1300016 z = 1300017 z = 1300018 z = 1300019 z = 1300020 z = 1300021

10   Pass
x = 179424710; y_correct = 179424719; assert(isequal(nearestprime(x),y_correct))

z = 179424711 z = 179424712 z = 179424713 z = 179424714 z = 179424715 z = 179424716 z = 179424717 z = 179424718 z = 179424719