Cody

Solution 1887646

Submitted on 30 Jul 2019 by Thomas Werner
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))

n = 0 m = 0 m = 1 m = 2 y = 2

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

n = 5 m = 5 y = 5

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

n = 100 m = 100 n = 99 n = 98 n = 97 m = 101 y = 101

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

n = 500 m = 500 n = 499 m = 501 m = 502 m = 503 y = 499

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

n = 911 m = 911 y = 911

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

n = 2500 m = 2500 n = 2499 n = 2498 n = 2497 n = 2496 n = 2495 n = 2494 n = 2493 n = 2492 n = 2491 n = 2490 n = 2489 n = 2488 n = 2487 n = 2486 n = 2485 n = 2484 n = 2483 n = 2482 n = 2481 n = 2480 n = 2479 n = 2478 n = 2477 m = 2501 m = 2502 m = 2503 y = 2503

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

n = 8000 m = 8000 n = 7999 n = 7998 n = 7997 n = 7996 n = 7995 n = 7994 n = 7993 m = 8001 m = 8002 m = 8003 m = 8004 m = 8005 m = 8006 m = 8007 m = 8008 m = 8009 y = 7993

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

n = 100000 m = 100000 n = 99999 n = 99998 n = 99997 n = 99996 n = 99995 n = 99994 n = 99993 n = 99992 n = 99991 m = 100001 m = 100002 m = 100003 y = 100003

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

n = 1300000 m = 1300000 n = 1299999 n = 1299998 n = 1299997 n = 1299996 n = 1299995 n = 1299994 n = 1299993 n = 1299992 n = 1299991 n = 1299990 n = 1299989 m = 1300001 m = 1300002 m = 1300003 m = 1300004 m = 1300005 m = 1300006 m = 1300007 m = 1300008 m = 1300009 m = 1300010 m = 1300011 m = 1300012 m = 1300013 m = 1300014 m = 1300015 m = 1300016 m = 1300017 m = 1300018 m = 1300019 m = 1300020 m = 1300021 y = 1299989

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

n = 179424710 m = 179424710 n = 179424709 n = 179424708 n = 179424707 n = 179424706 n = 179424705 n = 179424704 n = 179424703 n = 179424702 n = 179424701 n = 179424700 n = 179424699 n = 179424698 n = 179424697 m = 179424711 m = 179424712 m = 179424713 m = 179424714 m = 179424715 m = 179424716 m = 179424717 m = 179424718 m = 179424719 y = 179424719

Suggested Problems

More from this Author44