Cody

Problem 44675. Find prime number couples

Solution 1552456

Submitted on 7 Jun 2018 by J-G van der Toorn
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=[1 4 6 7 8 11 13 16 23 29 31]; couple=[11 13; 29 31]; assert(isequal(find_prime_couples(a),couple))

ans = 11 13 29 31

2   Pass
a=[16 97 88 49 41 13 93 1 19 33 6 15 73 49 34 24 46 19 33 27 84 70 34 59 29 27 26 68 52 8 6 26 44 29 68 95 78 64 76 75 59 78 40 61 25 30 2 35 15 42 16 83 74 10 83 23 11 67 96 82 63 33 28 44 36 88 1 70 34 31 65 93 90 100 8 13 99 10 69 93 15 89 2 35 24 99 85 80 91 79 84 33 75 67 29 34 91 4 70 21]; couple=[11 13; 29 31; 59 61]; assert(isequal(find_prime_couples(a),couple))

ans = 11 13 29 31 59 61

3   Pass
a=[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 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199]; couple=[3 5; 5 7; 11 13; 17 19; 29 31; 41 43; 59 61; 71 73; 101 103; 107 109; 137 139; 149 151; 179 181; 191 193; 197 199]; assert(isequal(find_prime_couples(a),couple))

ans = 3 5 5 7 11 13 17 19 29 31 41 43 59 61 71 73 101 103 107 109 137 139 149 151 179 181 191 193 197 199

Suggested Problems

Community Treasure Hunt

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

Start Hunting!