Cody

# Problem 44645. Prime numbers between a , b.

Solution 3476474

Submitted on 30 Oct 2020 by Payam Morsali
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
a=100; b=120; y_correct = [101 103 107 109 113]; assert(isequal(allprimes(a,b),y_correct))

a1 = 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 b1 = Columns 1 through 29 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 Column 30 113 z = 0 0 0 0 0 z1 = Columns 1 through 29 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 0 0 0 0 Column 30 0 b2 = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 101 103 107 109 Column 30 113 y = 101 103 107 109 113

2   Pass
a=140; b=180; y_correct = [149 151 157 163 167 173 179]; assert(isequal(allprimes(a,b),y_correct))

a1 = Columns 1 through 29 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 Columns 30 through 34 113 127 131 137 139 b1 = Columns 1 through 29 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 Columns 30 through 41 113 127 131 137 139 149 151 157 163 167 173 179 z = 0 0 0 0 0 0 0 z1 = Columns 1 through 29 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 Columns 30 through 41 113 127 131 137 139 0 0 0 0 0 0 0 b2 = Columns 1 through 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 30 through 41 0 0 0 0 0 149 151 157 163 167 173 179 y = 149 151 157 163 167 173 179

3   Pass
a=14; b=20; y_correct = [17 19]; assert(isequal(allprimes(a,b),y_correct))

a1 = 2 3 5 7 11 13 b1 = 2 3 5 7 11 13 17 19 z = 0 0 z1 = 2 3 5 7 11 13 0 0 b2 = 0 0 0 0 0 0 17 19 y = 17 19

### Community Treasure Hunt

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

Start Hunting!