Cody

Problem 47518. Play Outside In with primes

Solution 3668563

Submitted on 15 Nov 2020 by William
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 = 11; n = 6; y_correct = [1117 1171 2111 1213 2131 1217]; assert(isequal(OutsideInPrimes(x,n),y_correct))

2   Pass
x = 52; n = 10; y_correct = [1523 2131 1213 2137 1277 1171 1117 2179 1291 2111]; assert(isequal(OutsideInPrimes(x,n),y_correct))

3   Pass
x = 88; n = 10; y_correct = [1889 1193 2131 1213 2137 1277 1171 1117 2179 1291]; assert(isequal(OutsideInPrimes(x,n),y_correct))

4   Pass
x = 66; n = 200; y = OutsideInPrimes(x,n); sum_correct = 1167614; y_correct_p = [10177 11171 11159 11903 11329 11909 11923 11351 11161 11173 11353 11369 11927 11177 11701 12113 11383 11393 11399]; assert(isequal(sum(y),sum_correct)) assert(isequal(y(149:167),y_correct_p))

Suggested Problems

More from this Author67

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!