Cody

# Problem 44305. 5 Prime Numbers

Solution 1305383

Submitted on 20 Oct 2017 by Ashley Goddard
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_min = 60; n_max = 1000; y_correct = [151,157,251,257,353]; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 60 b = 1000 s = '61' s = '67' s = '71' s = '73' s = '79' s = '83' s = '89' s = '97' s = '101' s = '103' s = '107' s = '109' s = '113' s = '127' s = '131' s = '137' s = '139' s = '149' s = '151' y = 151 s = '157' y = 151 157 s = '163' s = '167' s = '173' s = '179' s = '181' s = '191' s = '193' s = '197' s = '199' s = '211' s = '223' s = '227' s = '229' s = '233' s = '239' s = '241' s = '251' y = 151 157 251 s = '257' y = 151 157 251 257 s = '263' s = '269' s = '271' s = '277' s = '281' s = '283' s = '293' s = '307' s = '311' s = '313' s = '317' s = '331' s = '337' s = '347' s = '349' s = '353' y = 151 157 251 257 353

2   Pass
n_min = 60; n_max = 300; y_correct = -1; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 60 b = 300 s = '61' s = '67' s = '71' s = '73' s = '79' s = '83' s = '89' s = '97' s = '101' s = '103' s = '107' s = '109' s = '113' s = '127' s = '131' s = '137' s = '139' s = '149' s = '151' y = 151 s = '157' y = 151 157 s = '163' s = '167' s = '173' s = '179' s = '181' s = '191' s = '193' s = '197' s = '199' s = '211' s = '223' s = '227' s = '229' s = '233' s = '239' s = '241' s = '251' y = 151 157 251 s = '257' y = 151 157 251 257 s = '263' s = '269' s = '271' s = '277' s = '281' s = '283' s = '293' y = -1

3   Pass
n_min = 1; n_max = 200; y_correct = [5,53,59,151,157]; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 1 b = 200 s = '2' s = '3' s = '5' y = 5 s = '7' s = '11' s = '13' s = '17' s = '19' s = '23' s = '29' s = '31' s = '37' s = '41' s = '43' s = '47' s = '53' y = 5 53 s = '59' y = 5 53 59 s = '61' s = '67' s = '71' s = '73' s = '79' s = '83' s = '89' s = '97' s = '101' s = '103' s = '107' s = '109' s = '113' s = '127' s = '131' s = '137' s = '139' s = '149' s = '151' y = 5 53 59 151 s = '157' y = 5 53 59 151 157

4   Pass
n_min = 1; n_max = 100; y_correct = -1; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 1 b = 100 s = '2' s = '3' s = '5' y = 5 s = '7' s = '11' s = '13' s = '17' s = '19' s = '23' s = '29' s = '31' s = '37' s = '41' s = '43' s = '47' s = '53' y = 5 53 s = '59' y = 5 53 59 s = '61' s = '67' s = '71' s = '73' s = '79' s = '83' s = '89' s = '97' y = -1

5   Pass
n_min = 500; n_max = 600; y_correct = [503,509,521,523,541]; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 500 b = 600 s = '503' y = 503 s = '509' y = 503 509 s = '521' y = 503 509 521 s = '523' y = 503 509 521 523 s = '541' y = 503 509 521 523 541

6   Pass
n_min = 500; n_max = 555; y_correct = [503,509,521,523,541]; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 500 b = 555 s = '503' y = 503 s = '509' y = 503 509 s = '521' y = 503 509 521 s = '523' y = 503 509 521 523 s = '541' y = 503 509 521 523 541

7   Pass
n_min = 500; n_max = 500000000; y_correct = [503,509,521,523,541]; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 500 b = 500000000 b = 1499 s = '503' y = 503 s = '509' y = 503 509 s = '521' y = 503 509 521 s = '523' y = 503 509 521 523 s = '541' y = 503 509 521 523 541

8   Pass
n_min = 5000; n_max = 5020; y_correct = -1; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 5000 b = 5020 s = '5003' y = 5003 s = '5009' y = 5003 5009 s = '5011' y = 5003 5009 5011 y = -1

9   Pass
n_min = 5000; n_max = 5200; y_correct = [5003,5009,5011,5021,5023]; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 5000 b = 5200 s = '5003' y = 5003 s = '5009' y = 5003 5009 s = '5011' y = 5003 5009 5011 s = '5021' y = 5003 5009 5011 5021 s = '5023' y = 5003 5009 5011 5021 5023

10   Pass
n_min = 5000; n_max = 55555555; y_correct = [5003,5009,5011,5021,5023]; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 5000 b = 55555555 b = 5999 s = '5003' y = 5003 s = '5009' y = 5003 5009 s = '5011' y = 5003 5009 5011 s = '5021' y = 5003 5009 5011 5021 s = '5023' y = 5003 5009 5011 5021 5023

11   Pass
n_min = 55555; n_max = 56789; y_correct = [55579,55589,55603,55609,55619]; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 55555 b = 56789 b = 56554 s = '55579' y = 55579 s = '55589' y = 55579 55589 s = '55603' y = 55579 55589 55603 s = '55609' y = 55579 55589 55603 55609 s = '55619' y = 55579 55589 55603 55609 55619

12   Pass
n_min = 987654321; n_max = 988777666; y_correct = [987654323,987654337,987654347,987654359,987654361]; assert(isequal(five_primes(n_min,n_max),y_correct))

a = 987654321 b = 988777666 b = 987655320 s = '987654323' y = 987654323 s = '987654337' y = 987654323 987654337 s = '987654347' y = 987654323 987654337 987654347 s = '987654359' y = 987654323 987654337 987654347 987654359 s = '987654361' y = 987654323 987654337 987654347 987654359 987654361

### Community Treasure Hunt

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

Start Hunting!