Cody

Solution 1984513

Submitted on 21 Oct 2019 at 13:04 by Márk Barta
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
nList = 28:6:76; for i = 1:length(nList) n = nList(i); [p1,p2] = goldbach(n) assert(isprime(p1) && isprime(p2) && (p1+p2==n)); end

a = 1 b = 27 a = 2 b = 26 a = 3 b = 25 a = 4 b = 24 a = 5 b = 23 p1 = 5 p2 = 23 a = 6 b = 22 a = 7 b = 21 a = 8 b = 20 a = 9 b = 19 a = 10 b = 18 a = 11 b = 17 p1 = 11 p2 = 17 a = 12 b = 16 a = 13 b = 15 a = 14 b = 14 a = 15 b = 13 a = 16 b = 12 a = 17 b = 11 p1 = 17 p2 = 11 a = 18 b = 10 a = 19 b = 9 a = 20 b = 8 a = 21 b = 7 a = 22 b = 6 a = 23 b = 5 p1 = 23 p2 = 5 a = 24 b = 4 a = 25 b = 3 a = 26 b = 2 a = 27 b = 1 p1 = 23 p2 = 5 a = 1 b = 33 a = 2 b = 32 a = 3 b = 31 p1 = 3 p2 = 31 a = 4 b = 30 a = 5 b = 29 p1 = 5 p2 = 29 a = 6 b = 28 a = 7 b = 27 a = 8 b = 26 a = 9 b = 25 a = 10 b = 24 a = 11 b = 23 p1 = 11 p2 = 23 a = 12 b = 22 a = 13 b = 21 a = 14 b = 20 a = 15 b = 19 a = 16 b = 18 a = 17 b = 17 p1 = 17 p2 = 17 a = 18 b = 16 a = 19 b = 15 a = 20 b = 14 a = 21 b = 13 a = 22 b = 12 a = 23 b = 11 p1 = 23 p2 = 11 a = 24 b = 10 a = 25 b = 9 a = 26 b = 8 a = 27 b = 7 a = 28 b = 6 a = 29 b = 5 p1 = 29 p2 = 5 a = 30 b = 4 a = 31 b = 3 p1 = 31 p2 = 3 a = 32 b = 2 a = 33 b = 1 p1 = 31 p2 = 3 a = 1 b = 39 a = 2 b = 38 a = 3 b = 37 p1 = 3 p2 = 37 a = 4 b = 36 a = 5 b = 35 a = 6 b = 34 a = 7 b = 33 a = 8 b = 32 a = 9 b = 31 a = 10 b = 30 a = 11 b = 29 p1 = 11 p2 = 29 a = 12 b = 28 a = 13 b = 27 a = 14 b = 26 a = 15 b = 25 a = 16 b = 24 a = 17 b = 23 p1 = 17 p2 = 23 a = 18 b = 22 a = 19 b = 21 a = 20 b = 20 a = 21 b = 19 a = 22 b = 18 a = 23 b = 17 p1 = 23 p2 = 17 a = 24 b = 16 a = 25 b = 15 a = 26 b = 14 a = 27 b = 13 a = 28 b = 12 a = 29 b = 11 p1 = 29 p2 = 11 a = 30 b = 10 a = 31 b = 9 a = 32 b = 8 a = 33 b = 7 a = 34 b = 6 a = 35 b = 5 a = 36 b = 4 a = 37 b = 3 p1 = 37 p2 = 3 a = 38 b = 2 a = 39 b = 1 p1 = 37 p2 = 3 a = 1 b = 45 a = 2 b = 44 a = 3 b = 43 p1 = 3 p2 = 43 a = 4 b = 42 a = 5 b = 41 p1 = 5 p2 = 41 a = 6 b = 40 a = 7 b = 39 a = 8 b = 38 a = 9 b = 37 a = 10 b = 36 a = 11 b = 35 a = 12 b = 34 a = 13 b = 33 a = 14 b = 32 a = 15 b = 31 a = 16 b = 30 a = 17 b = 29 p1 = 17 p2 = 29 a = 18 b = 28 a = 19 b = 27 a = 20 b = 26 a = 21 b = 25 a = 22 b = 24 a = 23 b = 23 p1 = 23 p2 = 23 a = 24 b = 22 a = 25 b = 21 a = 26 b = 20 a = 27 b = 19 a = 28 b = 18 a = 29 b = 17 p1 = 29 p2 = 17 a = 30 b = 16 a = 31 b = 15 a = 32 b = 14 a = 33 b = 13 a = 34 b = 12 a = 35 b = 11 a = 36 b = 10 a = 37 b = 9 a = 38 b = 8 a = 39 b = 7 a = 40 b = 6 a = 41 b = 5 p1 = 41 p2 = 5 a = 42 b = 4 a = 43 b = 3 p1 = 43 p2 = 3 a = 44 b = 2 a = 45 b = 1 p1 = 43 p2 = 3 a = 1 b = 51 a = 2 b = 50 a = 3 b = 49 a = 4 b = 48 a = 5 b = 47 p1 = 5 p2 = 47 a = 6 b = 46 a = 7 b = 45 a = 8 b = 44 a = 9 b = 43 a = 10 b = 42 a = 11 b = 41 p1 = 11 p2 = 41 a = 12 b = 40 a = 13 b = 39 a = 14 b = 38 a = 15 b = 37 a = 16 b = 36 a = 17 b = 35 a = 18 b = 34 a = 19 b = 33 a = 20 b = 32 a = 21 b = 31 a = 22 b = 30 a = 23 b = 29 p1 = 23 p2 = 29 a = 24 b = 28 a = 25 b = 27 a = 26 b = 26 a = 27 b = 25 a = 28 b = 24 a = 29 b = 23 p1 = 29 p2 = 23 a = 30 b = 22 a = 31 b = 21 a = 32 b = 20 a = 33 b = 19 a = 34 b = 18 a = 35 b = 17 a = 36 b = 16 a = 37 b = 15 a = 38 b = 14 a = 39 b = 13 a = 40 b = 12 a = 41 b = 11 p1 = 41 p2 = 11 a = 42 b = 10 a = 43 b = 9 a = 44 b = 8 a = 45 b = 7 a = 46 b = 6 a = 47 b = 5 p1 = 47 p2 = 5 a = 48 b = 4 a = 49 b = 3 a = 50 b = 2 a = 51 b = 1 p1 = 47 p2 = 5 a = 1 b = 57 a = 2 b = 56 a = 3 b = 55 a = 4 b = 54 a = 5 b = 53 p1 = 5 p2 = 53 a = 6 b = 52 a = 7 b = 51 a = 8 b = 50 a = 9 b = 49 a = 10 b = 48 a = 11 b = 47 p1 = 11 p2 = 47 a = 12 b = 46 a = 13 b = 45 a = 14 b = 44 a = 15 b = 43 a = 16 b = 42 a = 17 b = 41 p1 = 17 p2 = 41 a = 18 b = 40 a = 19 b = 39 a = 20 b = 38 a = 21 b = 37 a = 22 b = 36 a = 23 b = 35 a = 24 b = 34 a = 25 b = 33 a = 26 b = 32 a = 27 b = 31 a = 28 b = 30 a = 29 b = 29 p1 = 29 p2 = 29 a = 30 b = 28 a = 31 b = 27 a = 32 b = 26 a = 33 b = 25 a = 34 b = 24 a = 35 b = 23 a = 36 b = 22 a = 37 b = 21 a = 38 b = 20 a = 39 b = 19 a = 40 b = 18 a = 41 b = 17 p1 = 41 p2 = 17 a = 42 b = 16 a = 43 b = 15 a = 44 b = 14 a = 45 b = 13 a = 46 b = 12 a = 47 b = 11 p1 = 47 p2 = 11 a = 48 b = 10 a = 49 b = 9 a = 50 b = 8 a = 51 b = 7 a = 52 b = 6 a = 53 b = 5 p1 = 53 p2 = 5 a = 54 b = 4 a = 55 b = 3 a = 56 b = 2 a = 57 b = 1 p1 = 53 p2 = 5 a = 1 b = 63 a = 2 b = 62 a = 3 b = 61 p1 = 3 p2 = 61 a = 4 b = 60 a = 5 b = 59 p1 = 5 p2 = 59 a = 6 b = 58 a = 7 b = 57 a = 8 b = 56 a = 9 b = 55 a = 10 b = 54 a = 11 b = 53 p1 = 11 p2 = 53 a = 12 b = 52 a = 13 b = 51 a = 14 b = 50 a = 15 b = 49 a = 16 b = 48 a = 17 b = 47 p1 = 17 p2 = 47 a = 18 b = 46 a = 19 b = 45 a = 20 b = 44 a = 21 b = 43 a = 22 b = 42 a = 23 b = 41 p1 = 23 p2 = 41 a = 24 b = 40 a = 25 b = 39 a = 26 b = 38 a = 27 b = 37 a = 28 b = 36 a = 29 b = 35 a = 30 b = 34 a = 31 b = 33 a = 32 b = 32 a = 33 b = 31 a = 34 b = 30 a = 35 b = 29 a = 36 b = 28 a = 37 b = 27 a = 38 b = 26 a = 39 b = 25 a = 40 b = 24 a = 41 b = 23 p1 = 41 p2 = 23 a = 42 b = 22 a = 43 b = 21 a = 44 b = 20 a = 45 b = 19 a = 46 b = 18 a = 47 b = 17 p1 = 47 p2 = 17 a = 48 b = 16 a = 49 b = 15 a = 50 b = 14 a = 51 b = 13 a = 52 b ...

2   Pass
nList = [18 20 22 100 102 114 1000 2000 36 3600]; for i = 1:length(nList) n = nList(i); [p1,p2] = goldbach(n) assert(isprime(p1) && isprime(p2) && (p1+p2==n)); end

a = 1 b = 17 a = 2 b = 16 a = 3 b = 15 a = 4 b = 14 a = 5 b = 13 p1 = 5 p2 = 13 a = 6 b = 12 a = 7 b = 11 p1 = 7 p2 = 11 a = 8 b = 10 a = 9 b = 9 a = 10 b = 8 a = 11 b = 7 p1 = 11 p2 = 7 a = 12 b = 6 a = 13 b = 5 p1 = 13 p2 = 5 a = 14 b = 4 a = 15 b = 3 a = 16 b = 2 a = 17 b = 1 p1 = 13 p2 = 5 a = 1 b = 19 a = 2 b = 18 a = 3 b = 17 p1 = 3 p2 = 17 a = 4 b = 16 a = 5 b = 15 a = 6 b = 14 a = 7 b = 13 p1 = 7 p2 = 13 a = 8 b = 12 a = 9 b = 11 a = 10 b = 10 a = 11 b = 9 a = 12 b = 8 a = 13 b = 7 p1 = 13 p2 = 7 a = 14 b = 6 a = 15 b = 5 a = 16 b = 4 a = 17 b = 3 p1 = 17 p2 = 3 a = 18 b = 2 a = 19 b = 1 p1 = 17 p2 = 3 a = 1 b = 21 a = 2 b = 20 a = 3 b = 19 p1 = 3 p2 = 19 a = 4 b = 18 a = 5 b = 17 p1 = 5 p2 = 17 a = 6 b = 16 a = 7 b = 15 a = 8 b = 14 a = 9 b = 13 a = 10 b = 12 a = 11 b = 11 p1 = 11 p2 = 11 a = 12 b = 10 a = 13 b = 9 a = 14 b = 8 a = 15 b = 7 a = 16 b = 6 a = 17 b = 5 p1 = 17 p2 = 5 a = 18 b = 4 a = 19 b = 3 p1 = 19 p2 = 3 a = 20 b = 2 a = 21 b = 1 p1 = 19 p2 = 3 a = 1 b = 99 a = 2 b = 98 a = 3 b = 97 p1 = 3 p2 = 97 a = 4 b = 96 a = 5 b = 95 a = 6 b = 94 a = 7 b = 93 a = 8 b = 92 a = 9 b = 91 a = 10 b = 90 a = 11 b = 89 p1 = 11 p2 = 89 a = 12 b = 88 a = 13 b = 87 a = 14 b = 86 a = 15 b = 85 a = 16 b = 84 a = 17 b = 83 p1 = 17 p2 = 83 a = 18 b = 82 a = 19 b = 81 a = 20 b = 80 a = 21 b = 79 a = 22 b = 78 a = 23 b = 77 a = 24 b = 76 a = 25 b = 75 a = 26 b = 74 a = 27 b = 73 a = 28 b = 72 a = 29 b = 71 p1 = 29 p2 = 71 a = 30 b = 70 a = 31 b = 69 a = 32 b = 68 a = 33 b = 67 a = 34 b = 66 a = 35 b = 65 a = 36 b = 64 a = 37 b = 63 a = 38 b = 62 a = 39 b = 61 a = 40 b = 60 a = 41 b = 59 p1 = 41 p2 = 59 a = 42 b = 58 a = 43 b = 57 a = 44 b = 56 a = 45 b = 55 a = 46 b = 54 a = 47 b = 53 p1 = 47 p2 = 53 a = 48 b = 52 a = 49 b = 51 a = 50 b = 50 a = 51 b = 49 a = 52 b = 48 a = 53 b = 47 p1 = 53 p2 = 47 a = 54 b = 46 a = 55 b = 45 a = 56 b = 44 a = 57 b = 43 a = 58 b = 42 a = 59 b = 41 p1 = 59 p2 = 41 a = 60 b = 40 a = 61 b = 39 a = 62 b = 38 a = 63 b = 37 a = 64 b = 36 a = 65 b = 35 a = 66 b = 34 a = 67 b = 33 a = 68 b = 32 a = 69 b = 31 a = 70 b = 30 a = 71 b = 29 p1 = 71 p2 = 29 a = 72 b = 28 a = 73 b = 27 a = 74 b = 26 a = 75 b = 25 a = 76 b = 24 a = 77 b = 23 a = 78 b = 22 a = 79 b = 21 a = 80 b = 20 a = 81 b = 19 a = 82 b = 18 a = 83 b = 17 p1 = 83 p2 = 17 a = 84 b = 16 a = 85 b = 15 a = 86 b = 14 a = 87 b = 13 a = 88 b = 12 a = 89 b = 11 p1 = 89 p2 = 11 a = 90 b = 10 a = 91 b = 9 a = 92 b = 8 a = 93 b = 7 a = 94 b = 6 a = 95 b = 5 a = 96 b = 4 a = 97 b = 3 p1 = 97 p2 = 3 a = 98 b = 2 a = 99 b = 1 p1 = 97 p2 = 3 a = 1 b = 101 a = 2 b = 100 a = 3 b = 99 a = 4 b = 98 a = 5 b = 97 p1 = 5 p2 = 97 a = 6 b = 96 a = 7 b = 95 a = 8 b = 94 a = 9 b = 93 a = 10 b = 92 a = 11 b = 91 a = 12 b = 90 a = 13 b = 89 p1 = 13 p2 = 89 a = 14 b = 88 a = 15 b = 87 a = 16 b = 86 a = 17 b = 85 a = 18 b = 84 a = 19 b = 83 p1 = 19 p2 = 83 a = 20 b = 82 a = 21 b = 81 a = 22 b = 80 a = 23 b = 79 p1 = 23 p2 = 79 a = 24 b = 78 a = 25 b = 77 a = 26 b = 76 a = 27 b = 75 a = 28 b = 74 a = 29 b = 73 p1 = 29 p2 = 73 a = 30 b = 72 a = 31 b = 71 p1 = 31 p2 = 71 a = 32 b = 70 a = 33 b = 69 a = 34 b = 68 a = 35 b = 67 a = 36 b = 66 a = 37 b = 65 a = 38 b = 64 a = 39 b = 63 a = 40 b = 62 a = 41 b = 61 p1 = 41 p2 = 61 a = 42 b = 60 a = 43 b = 59 p1 = 43 p2 = 59 a = 44 b = 58 a = 45 b = 57 a = 46 b = 56 a = 47 b = 55 a = 48 b = 54 a = 49 b = 53 a = 50 b = 52 a = 51 b = 51 a = 52 b = 50 a = 53 b = 49 a = 54 b = 48 a = 55 b = 47 a = 56 b = 46 a = 57 b = 45 a = 58 b = 44 a = 59 b = 43 p1 = 59 p2 = 43 a = 60 b = 42 a = 61 b = 41 p1 = 61 p2 = 41 a = 62 b = 40 a = 63 b = 39 a = 64 b = 38 a = 65 b = 37 a = 66 b = 36 a = 67 b = 35 a = 68 b = 34 a = 69 b = 33 a = 70 b = 32 a = 71 b = 31 p1 = 71 p2 = 31 a = 72 b = 30 a = 73 b = 29 p1 = 73 p2 = 29 a = 74 b = 28 a = 75 b = 27 a = 76 b = 26 a = 77 b = 25 a = 78 b = 24 a = 79 b = 23 p1 = 79 p2 = 23 a = 80 b = 22 a = 81 b = 21 a = 82 b = 20 a = 83 b = 19 p1 = 83 p2 = 19 a = 84 b = 18 a = 85 b = 17 a = 86 b = 16 a = 87 b = 15 a = 88 b = 14 a = 89 b = 13 p1 = 89 p2 = 13 a = 90 b = 12 a = 91 b = 11 a = 92 b = 10 a = 93 b = 9 a = 94 b = 8 a = 95 b = 7 a = 96 b = 6 a = 97 b = 5 p1 = 97 p2 = 5 a = 98 b = 4 a = 99 b = 3 a = 100 b = 2 a = 101 b = 1 p1 = 97 p2 = 5 a = 1 b = 113 a = 2 b = 112 a = 3 b = 111 a = 4 b = 110 a = 5 b = 109 p1 = 5 p2 = 109 a = 6 b = 108 a = 7 b = 107 p1 = 7 p2 = 107 a = 8 b = 106 a = 9 b = 105 a = 10 b = 104 a = 11 b = 103 p1 = 11 p2 = 103 a = 12 b = 102 a = 13 b = 101 p1 = 13 p2 = 101 a = 14 b = 100 a = 15 b = 99 a = 16 b = 98 a = 17 b = 97 p1 = 17 p2 = 97 a = 18 b = 96 a = 19 b = 95 a = 20 b = 94 a = 21 b = 93 a = 22 b = 92 a = 23 b = 91 a = 24 b = 90 a = 25 b = 89 a = 26 b = 88 a = 27 b = 87 a = 28 b = 86 a = 29 b = 85 a = 30 b = 84 a = 31 b = 83 p1 = 31 p2 = 83 a = 32 b = 82 a = 33 b = 81 a = 34 b = 80 a = 35 b = 79 a = 36 b = 78 a = 37 b = 77 a = 38 b = 76 a = 39 b = 75 a = 40 b = 74 a = 41 b = 73 p1 = 41 p2 = 73 a = 42 b = 72 a = 43 b = 71 p1 = ...